Validate #required, #maxlength and #options in standard #element_validate handlers

Created on 1 November 2012, about 12 years ago
Updated 16 August 2023, over 1 year ago

_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.

πŸ“Œ Task
Status

Postponed: needs info

Version

9.5

Component
FormΒ  β†’

Last updated 3 days ago

Created by

πŸ‡©πŸ‡°Denmark c960657

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024