- Issue created by @fromme
- Merge request !72Update validation of required integer fields with "0" value in ConditionalFieldsFormHelper.php → (Open) created by fromme
Conditional Fields does not validate integers the same way that Drupal does. An integer field with a value of 0 and being Required by this module returns an error indicating the field is required despite the fact that the field is not empty
1. Add two fields on any entity, for example taxonomy:
field_one - number (integer), minimum value set to 0;
field_two - boolean;
2. Go to admin/structure/conditional_fields/taxonomy_term/{your_vocabulary}
Add condition: field_one is required if field_two checked.
3. Edit term: check field_two, set 0 to field_one, save.
Update validation in ConditionalFieldsFormHelper.php -> dependentValidate:
use
if (empty($input_state) && $input_state !== '0')
instead of
if (empty($input_state))
Active
4.0
Code