Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Could be great if regular expression validation accept all value, also "no value".
This could permits to check if field is filled... a "required" substitution that permits to replace error message.
For more info see:
#889198: Add capability to use custom error message for required field
#742344: Allow forms to set custom validation error messages on required fields
Comment | File | Size | Author |
---|---|---|---|
#1 | 1110506-make_regular_expression_validation_more_flexible.patch | 758 bytes | robertom |
Comments
Comment #1
robertom CreditAttribution: robertom commentedComment #2
svendecabooterThe extra check was actually added to account for the fact that a value of "0" was not being validated.
See #978490: With RegExp, an 0 is accepted
I think that issue has higher priority over this one, but your use case is valid as well of course.
I suppose we could just add a new simple validation rule "Required" to make sure anything is filled in (including zeros).
Comment #3
Liam MorlandFields can already be marked required in Webform.