Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Hidden Field No Longer Works #113

Closed
EricHamby opened this Issue · 2 comments

3 participants

@EricHamby

Using the updated options.php the drop down hidden fields no longer work.

@devinsays
Owner

Works for me.

Make sure to have the function optionsframework_custom_scripts in your functions.php file (like it has in options-check), if you want that to work.

@devinsays devinsays closed this
@helgatheviking

just ran into this, didn't realize that the options.php had to add an action, so i thought it was broken too. since i am hacking this up to work as plugin options, i decided to add a class to any checkbox that I want to serve as the "toggle" for the ensuing hidden input

$options[] = array(
    'name' => __('Check to Show a Hidden Text Input', "po-starter"),
    'desc' => __('Click here and see what happens.', "po-starter"),
    'id' => 'example_showhidden',
    'class' => 'has_hidden_child',
    'type' => 'checkbox');

then in the custom.js file a little .each() love so that the whole thing happens automatically without the need to manually write anything further (and with explicit IDs) for every hidden input you care to use.

    // checkboxes with hidden inputs 
    $('.has_hidden_child').find('input:checkbox').each(function(){ 

        if ( $(this).is(":checked")) { 
            $(this).parents('.section').next().show();
        }

        $(this).change(function() { 
            $(this).parents('.section').next().fadeToggle(400);
        });

    });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.