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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

robertom’s picture

Status: Active » Needs review
FileSize
758 bytes
svendecabooter’s picture

Status: Needs review » Needs work

The 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).

Liam Morland’s picture

Status: Needs work » Closed (works as designed)

Fields can already be marked required in Webform.