7.6 only - some FormEngineValidation checks are not adding has-error class (which also results in save ignoring error)
I think this is fixed in current master due to this change:
But in 7.6 FormEngineValidation.js adds the has-error class still in each individual error check.
However, that isn't done everywhere.
e.g. inline minitems / maxitems check not added at all and select minitems too.
However, this also results in the error being ignored on save.
#4 Updated by Frank Naegler about 1 year ago
- Status changed from New to Needs Feedback
I can't reproduce the problem with your description, also I can't see a reason why the mentioned commit should solve an issue like this.
Can you please give me more detailed information about the problem and provide an example TCA to reproduce the problem?
#5 Updated by Andreas Allacher about 1 year ago
The commit fixes the behaviour because it adds has-error css class the to the field itself everytime the value
markParent was set to true.
Which was not the case prior.
For instance if you have a TCA configuration like:
<?php $GLOBALS['TCA']['test_table']['columns']['test_column'] = [ 'config' => [ 'type' => 'select', 'renderType' => 'selectMultipleSideBySide', 'minitems' => '1, 'items' => [ ['foo', 'foo'], ['bar', 'bar'] ] ] ]
And you haven't selected an item, you will be able to store the data and the tab will have an error mark but not the field itself, the reason:
Look at line 307 there. In comparison to 314.
That is not the only place where the corresponding class is not appended, e.g. type group and inline don't add the class at all.
#6 Updated by Andreas Allacher about 1 year ago
I re-checked there are also some instances where the validation might not work in master either, e.g. SelectSingleElement maxitems = 1 also excepts a selected value that is empty (empty string), e.g. if one wants to create an option like "Please choose".
Although that might be the correct behaviour as one just has to add 'eval' => 'required' to achieve that check but only if one uses strings (as zero would not be an allowed value with required).
Of course if there is not please choose option there always will be a selected value but it might accidentally be the default value instead of the wanted value but that might be a feature request instead.
#7 Updated by Andreas Allacher about 1 year ago
Just further information: using range and lower would also support disallowing 0 (as long as there are no values lower). So having minitems with a single select can be achieved by using other evals.