Note that there are some explanatory texts on larger screens.

plurals
  1. POZend Form validator is not triggered
    primarykey
    data
    text
    <p>I am trying to get my UniqueEmail validator working but it seems that my validator is never triggered. </p> <p>This is my form:</p> <pre><code>class EventManager_Form_User_Base extends SF_Form_Abstract{ public function init(){ $this-&gt;addElementPrefixPath( 'EventManager_Validate', APPLICATION_PATH . '/modules/eventManager/models/validate', 'validate' ); (...) $this-&gt;addElement('text','usr_email', array( 'filters' =&gt; array('StringTrim', 'StringToLower'), 'valdators' =&gt; array( array('StringLength',true,array(3,128)), array('EmailAddress'), array('UniqueEmail', false, array(new EventManager_Model_User())), ), 'required' =&gt; true, 'label' =&gt; 'email', )); (...) } </code></pre> <p>}</p> <p>And here is my validator</p> <pre><code>class EventManager_Validate_UniqueEmail extends Zend_Validate_Abstract{ const EMAIL_EXISTS = 'emailExists'; protected $_messageTemplates = array( Self::EMAIL_EXISTS =&gt; 'Email "%value%" already exists in our system', ); public function __constructs(EventManager_Model_User $model){ $this-&gt;_model = $model; } public function isValid($value,$context = null){ $this-&gt;_setValue($value); $currentUser = isset($context['usr_id']) ? $this-&gt;_model-&gt;getUserById($context['user_id']) : null; $user = $this-&gt;_model-&gt;getUserByEmail($value, $currentUser); if(null === $user){ return true; } $this-&gt;_error(self::EMAIL_EXISTS); return false; } } </code></pre> <p>When I add the line </p> <pre><code>var_dump($value); exit; </code></pre> <p>in the first line of my isValid() function and then run my form. then the code just runs but seems not to get into my validator.</p> <p>I am running zf 1.10.1 any idea's / suggestions?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload