Removing a validator from a form element

To remove a validator from an element, you will need to open process.php and find the code that creates and configures the element you want to remove the validator from. Look for the line that has code similar to the code below.

1
$element->addValidator('required');
$element->addValidator('required');

Remove the line to remove that validator.

Removing a single validator where there are multiple

If the element has multiple validators added in a single line like below, and you only want to remove one of them, see below.

1
$element->addValidators(array('required', 'email'));
$element->addValidators(array('required', 'email'));

To remove only the email validator make it like below.

1
$element->addValidators(array('required'));
$element->addValidators(array('required'));

To remove all validators, delete or comment out the entire line.

Still having trouble? Head over to the forums.

Forums