Forum Replies Created
-
AuthorPosts
-
Jason Kinney
ParticipantHelp?
This is a huge issue. People filling out forms on the front or back end are getting incredibly frustrated when trying to save a form.
They have no way of knowing there are required fields on other other tabs without cycling through each tab and looking for required fields.
Jason Kinney
ParticipantI am using the tabs extension. That is how the extension is outputting the markup.
https://www.screencast.com/t/4SlfgLGdb9l.
I have other tabs in other setting pages that are titled Static Images and the filter runs on all meta boxes so the filter would need to be able to target specific settings pages or I need unique css ID's and/or the ability to add a class to a settings page.
Otherwise, it seems that any tab that has the title Static Images will get unwillingly targeted.
I added a prefix to the tabs array key under $settings_pages[] and this works, but targeting a href in css seems hacky. A custom class wrapper would seems more appropriate and/or a filter that can target a settings page and not run on all pages.
June 21, 2018 at 12:35 AM in reply to: action rwmb_after_{$meta_box_id} or action for settings page #10284Jason Kinney
ParticipantPerfect, tks!.
Is that listed hook listed in the docs?
Jason Kinney
ParticipantThe tabs are part of a settings page, i.e, $settings_pages[]; however, there are not css selectors to target a specific tab.
<h2 class="nav-tab-wrapper"> <a href="#tab-general">General Settings</a> <a href="#tab-static_images">Static Ad Images</a> </h2>Assuming I have a css selector I can target, to hide a settings tab with the css selector .nav-tab-status and the meta field ID that controls the tab is "status" and the select option is "off" this would remove the tab:
add_filter( 'rwmb_outside_conditions', function( $conditions ) { $conditions['.nat-tab-status'] = array( 'hidden' => array( 'status', '=', 'off' ), ); return $conditions; } );FYI, Although this would not help, I added 'class' -> '.xxx' under the $settings_pages[] array and the class is not added. Does class only work on met box fields?
Also how do you wrap code in this form?
Jason Kinney
ParticipantAll other aspects of the field hide, except the "before"
June 19, 2018 at 4:25 PM in reply to: action rwmb_after_{$meta_box_id} or action for settings page #10251Jason Kinney
ParticipantSorry I meant rwmb_{$meta_box_id}_after_save_post . . . instead of a meta box ID, a $settings_pages[id] as opposed to the meta_boxes[id].
fyi, there is a space in the action of "rwmb_{$meta_box_id}_ after_save_post."
Jason Kinney
Participant'required' => 1 as per the builder output.
If I use validation will an error message pop up if the the required field is not visible in the current tab?
Jason Kinney
ParticipantI have not yet embraced the builder, I only use it to figure out, "pure code" when the docs are not clear to me.
The array is posted below and here is the full code: https://pastebin.com/9HDWnjmU.
I think, but I have not tested it, the issue has to do when an image field is wrapped in a tab and/or group. It's also possible that it's tied to another BUG I found with tabs and groups. On a settings page I defined 3 tabs and under tab 3 I have several meta boxes. Although each meta box had a unique ID and all the values were saved to the db under the unique array key (as it should) if another meta box had a matching field ID, the 'std' => array ('yes') for an options list only worked on the last instance of 'std'.
To recreate that bug, create a tab, assign two or more meta boxes to the tab, in each meta box create a button group (i.e., a Yes/No button) and set the selected value to 'no'. Keep the button group ID same for the button group in each unique meta box. The result is the last button group will be the only one that has a default option selected.
Otherwise, max_status works, when it's not a tab or group.
-
AuthorPosts