Assume the following element:

$form['field'] = array(
    '#type' => 'textfield',
    '#title' => 'Foobar',
    '#rules' => array('alpha'), // or 'digit'
  );

The validation itself is working fine, but when you delete the value after the validation mechanism has been activated, you'll get a validation error if you leave the field empty.
If you deactivate clientside_validation an empty field is accepted by fapi_validation.

I assume this is caused by wrong regexp.

Comments

haggins’s picture

Status: Active » Needs review
StatusFileSize
new1.22 KB

Here's the patch. It affected alpha, digit, alpha_numeric and alpha_dash. I just replaced "+" with "*" as + forces at least 1 occurrence.

jelle_s’s picture

Fixed in latest dev version. Thanks for the patch!

jelle_s’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.