WordPress.org

Ready to get started?Download WordPress

Forums

Check for checked check boxes in settings... (1 post)

  1. Adam
    Member
    Posted 1 year ago #

    So I hate checkboxes in the settings API, I will tell you this much.

    I have a checkbox that I set up as such:

    if(!function_exists('aisis_theme_options_sidebar')){
    		function aisis_theme_options_sidebar(){
    			$options = get_option('aisis_core_theme_setting_sidebar');
    			?>
                <input type="checkbox" name="aisis_core_theme_setting_sidebar['no_side_bar']" value="0" <?php checked( $options['no_side_bar'], 0, true ); ?>  />
                <?php
    		}
    	}

    which just sets up a unchecked check box. We all know this.

    The problem seems to be my validation:

    if(!function_exists('aisis_core_theme_sidebar_validation')){
    		function aisis_core_theme_sidebar_validation($input){
    			$options = get_option('aisis_core_theme_setting_sidebar');
    			$options['no_side_bar'] = $input['no_side_bar'];
    			update_option('admin_success_message', 'true');
    			return $options;
    		}
    	}

    I am essentially saying to store what ever is in the input into the options - which we all know.

    Problem?

    $input['no_side_bar'] is empty.....even if I check the box....

    How is this possible?

    Inputs and text areas work just fine.

Topic Closed

This topic has been closed to new replies.

About this Topic