Set value for CheckBox field - Form API
By default checkbox works with 1, 0 values to be checked, unchecked respectivly.
you can use #return_value to set a desired value for the checkbox field is it is selected.
$form['custom_checkbox'] = array( '#type' => 'checkbox', '#title' => 'Title', '#default_value' => variable_get('custom_var'), );
you can use #return_value to set a desired value for the checkbox field is it is selected.
$form['custom_checkbox'] = array( '#type' => 'checkbox', '#title' => 'Title', '#return_value' => $key, '#default_value' => variable_get('custom_var'), );
Comments
Post a Comment