Custom form validation based on field name suffix or prefix pattern.
| Project: | Validation API |
| Version: | 6.x-1.0-alpha1 |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
What you have started is amazing and has tons of potential. Good and easy validation handling is so important!
It is common for administrators in Drupal to prefix or suffix their field names with a common 'data' type. For example, phone number fields might be suffixed with '_phone' creating names like 'profile_home_phone', 'profile_work_phone', and 'profile_mobile_phone'. Or administrators might prefix field names with 'phone_' creating names like 'profile_phone_work', 'profile_phone_home', and 'profile_phone_mobile'.
If administrators could define a prefix or suffix field name validation pattern, it would make it a lot easier to manage the side-wide validation for a specific 'data' type. I would steer clear from allowing any regex patterns since it could cause a major performance hit if every field name had to be checked via a regex.
A new input could be added to the validator form called 'Field Name Pattern' where it would validate any field name that 'starts with', 'ends with', or 'contains' a specific pattern.
A couple of examples of 'data' types that usually are added as prefix or suffix to a field name.
*_phone
*_fax
*_zipcode, *_zip
*_email
*_url
*_filename, *_file
*_creditcard, *_cc
*_ssn
*_datetime, *_date, *_time, *_year
*_color
*_money, *_currency
If this feature existed administrators, including myself, would be able to just turn off 'Add a validator to status'.

#1
I like this idea, and it will be considered for 2.0. However, since full release is so close, I will not be including it in this release.
Since, my focus has been for usability. I may focus on using wildcards for this, instead of regex. As many admins may be confused with working with regex.