Skip to content

Conditional logic based on checkbox #78

@clubdeuce

Description

@clubdeuce

When attempting to use conditional logic based on a checkbox, showing a sibling field when the checkbox is checked works as expected. However, only showing a field when the checkbox is unchecked does not:

Field::make_checkbox( 'curate_selection', _x( 'Curate the selection?', 'custom field label', 'xxx' ) )
	->set_option_value( true ),
Field::make_association( 'da_resource_types', __( 'DA Resource Types', 'scustom field label', 'xxx' ) )
	->set_conditional_logic( array(
		array(
			'field' => 'curate_selection',
			'value' => false,
		),
	) )
	->set_types( array(
		array(
			'type' => 'term',
			'taxonomy' => 'da_resource_type',
		),
	) ),
Field::make_association( 'da_resources', __( 'DA Resources', 'custom field label', 'xxx' ) )
	->set_max( 3 )
	->set_conditional_logic( array(
		array(
			'field' => 'curate_selection',
			'value' => true,
		),
	) )
	->set_types( array(
	     array(
		     'type'      => 'post',
		     'post_type' => 'da_resource',
	     ),
	) )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions