formapro / JsFormValidatorBundle

The Javascript validation for Symfony 2, 3 and 4 forms
MIT License
128 stars 57 forks source link

Regex match=false is ignored #59

Open abienvenu opened 10 years ago

abienvenu commented 10 years ago

Using this constraint with JsFormValidator v1.2.1 :

/**
 * @Assert\Regex(
 *     pattern="/\d/",
 *     match=false,
 *     message="Your name cannot contain a number"
 * )
 */

The javascript error message will appear when the name does NOT contain a number.

Of course there is a workaround :

/**
 * @Assert\Regex(
 *     pattern="/^[^\d]*$/",
 *     message="Your name cannot contain a number"
 * )
 */

But it would be great if JsFormValidator could support "match=false".