While creating a new entity with a number field /admin/structure/types/manage/task/fields/node.task.field_points
saving the field gives
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'form_validate_number' not found or invalid function name in Drupal\Core\Form\FormValidator->doValidateForm() (line 266 of core/lib/Drupal/Core/Form/FormValidator.php).
This seemed to be missed through #2326891: Convert system_element_info() to Element classes
This needs something like
+ '#element_validate' => array(
+ array($class, 'validateColor'),
+ ),
git diff 9c537ec4b20c4416c9b0265c1eeeb1d90ca0952a..9db4af56dae753528a2ffb721fed9d51e11f05b2
Comment | File | Size | Author |
---|---|---|---|
#1 | form_validate_number_is-2332685-1.patch | 1.29 KB | clemens.tolboom |
core-validate-number.patch | 1.36 KB | clemens.tolboom | |
Comments
Comment #1
clemens.tolboomremoved double line.
Comment #2
swentel CreditAttribution: swentel commentedRight, stupid error. Let's add a simple test so we don't break this again.
Comment #3
clemens.tolboom@swentel do you have some hints for a test?
Comment #4
swentel CreditAttribution: swentel commentedI would look at the testNumberFormatter() method in NumberFieldTest.php- that is testing the display settings in field ui.
We can easily go to the manage fields screen there first too and fill in 'bad' values and make sure the validation happens.
Comment #5
swentel CreditAttribution: swentel commentedComment #6
swentel CreditAttribution: swentel commented#2336443: NumericItemBase uses '#type' => 'textfield' for numeric 'min' and 'max' form fields might be the better fix.
Comment #7
swentel CreditAttribution: swentel commentedSo yeah, that's the right fix over there.