_form_validate() does several things that could be separated into standard #element_validate handlers for greater modularity and greater flexibility for modules implementing new form element types.
The check for #required and #maxlength is done inline in _form_validate(), while e.g. #pattern is checked with a separate element_validate handler.
_form_validate() also checks that the submitted value is among the available options in the #options array. Not all elements utilizing an #options array is checked in the same way, so the function is hardcodes to give 'checkboxes' and 'tableselect' elements special treatment. Not very general, and not very friendly towards custom modules implementing new elements that use an #options array.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | element-validate-1.patch | 38.55 KB | c960657 |
Comments
Comment #1
c960657 commentedThis patch tries to separate these checks into #element_validate handlers. It's not quite there yet, but I would like to hear some comments on the general idea.
Comment #3
attiks commentedI created #1845546: Implement validation for the TypedData API to try to solve this on all levels, since there are only 10 days left, we need to figure out what needs to be done before feature freeze and what can be done later.
Comment #16
smustgrave commentedSince there hasn't been movement on this in many years wonder if it's still a valid task?
If so could the IS be updated please.
Comment #18
quietone commentedThere has been no work on this task for 12 years. It is likely that it is no longer needed or has been implemented. And there has been no response to the query made about 2 years ago. Therefor, closing.
If there is work to do here, then either re-open the issue and add a comment or open a new issue and reference this one.