Dynamic Default Value for the Checkbox Field

A field’s settings can be set dynamically when the form is rendered on the page – this is when the field data is “localized” to the page for use by the form.

Dynamic Field Settings

The checkbox field uses the default_value setting to determine the checked/unchecked state of the checkbox field. This is different than the textbox field, which uses the default_value setting to set the value of the field, where as the checkbox field actually has two different value (a value for the checked state and a value for the unchecked state).

Related Filters

add_filter( ‘ninja_forms_localize_field’, ‘my_callback’ );

add_filter( ‘ninja_forms_localize_field_’ . $field_type, ‘my_callback’ );

Example

Full Example