carbon-fields
carbon-fields copied to clipboard
"Conditional logic" removes the input value from the database
Version
- Carbon Fields: 3.3
- WordPress: 5.9.3
- PHP: 7.1
Expected Behavior
When an input control depends on a checkbox control (through Conditional Logic), its value should not be deleted
Actual Behavior
For example, if a control textarea is dependent on a control checkbox (through Conditional Logic) by disabling the checkbox control, the value of the textarea is deleted and nothing saved into the database ( the value will be empty and reset)
Container definition
Container::make( 'theme_options', 'Custom Carbon Fields' )->add_fields( [
Field::make( 'checkbox', 'crb_checkbox_field', 'Sample Checkbox' ),
Field::make('textarea', 'crb_textarea_field', 'TextArea')->set_conditional_logic([
[
'field' => 'crb_checkbox_field',
'value' => true,
],
])
]);
Steps to Reproduce the Problem
- Check the checkbox
- Enter some test value into the textarea input or text input
- Save changes
- Uncheck the checkbox
- Save changes
- The value we previously entered for the text box will be deleted!
I guess this isn't going to be fixed anytime soon.