Support Forum » User Profile

Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • in reply to: BUG - validating fields in tabs #10335
    Jason KinneyJason Kinney
    Participant

    Help?

    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.

    in reply to: Hide tab #10292
    Jason KinneyJason Kinney
    Participant

    I 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.

    Jason KinneyJason Kinney
    Participant

    Perfect, tks!.

    Is that listed hook listed in the docs?

    in reply to: Hide tab #10283
    Jason KinneyJason Kinney
    Participant

    The 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?

    in reply to: "before" => "text" how do you hide it? #10258
    Jason KinneyJason Kinney
    Participant

    All other aspects of the field hide, except the "before"

    Jason KinneyJason Kinney
    Participant

    Sorry 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."

    in reply to: Huge bug with hidden fields #10245
    Jason KinneyJason 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?

    in reply to: BUG max_status ignored #10241
    Jason KinneyJason Kinney
    Participant

    I 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.

Viewing 8 posts - 1 through 8 (of 8 total)