I am writing a special validator that checks that at least one field matters. I want to confirm that the value "field name" or "idfield" has a value. One of them may be empty or both may be relevant, but at least one of them must be relevant.
$nameField = new Zend_Form_Element_Hidden('namefield');
$nameField->setValue($this->nameFieldValue)
->addValidator('AtLeastOneHasValue', false, array('idfield'));
From what I understand, my validator will not check if I have not specified my form element.
->setRequired(true)
But if I install it, it automatically checks that it is not empty, and the error message says that it is empty. I want the field to be empty and check multiple fields with my custom validator. How to check a form element with my custom validator without requiring a form element?
source
share