I'm trying to disable a checkbox depending on the state of another checkbox.
<form action="options.php" method="post" id="form_submission"> <table> <tr> <td width="200px"> <label for="first_option"><?php _e('First Option:', 'my_plugin'); ?></label> </td> <td> <input type="checkbox" name="first_option_show" value="show" <?php echo (get_option('first_option_show')=="show" ? 'checked' : '');?>> </td> <td> <input type="checkbox" name="first_option_required" value="required" <?php echo (get_option('first_option_required')=="required" ? 'checked' : '');?>> </td> </tr> </table> <input type="submit" name="submit" value="Save Settings"> </form>
So what I want in the script above, when the "first_option_show" is NOT checked I need the "first_option_required" to be disabled (whatever state the state of the "first_option_required" is check or unchecked, I don't clear the data in the DB).
I need this to run On Load of the page too, because as you can see the state of the "checkbox" come from the options.
I know it's probably an easy one, but I cannot get my head around it.
Just to make sure I give more information, the following will be in the Admin Area, it's for a plugin development, this is for a field in a different form, one option says if the field will be "showing" in the page form and the other one if the field will be required, which is why, if the field is not showing I want to disable the option if the "required" field.
Thanks in Advance!