addElement('text', 'schoolName', array('label' => 'School Name', 'required' => true)); $form->addElement('text', 'name', array('label' => 'Contact Name', 'required' => true)); $form->addElement('text', 'position', array('label' => 'Position', 'required' => true)); $form->addElement('phone', 'phone', array('label' => 'Phone Number')); $form->addElement( 'text', 'email', array( 'label' => 'Email', 'required' => true, 'description' => '(will be used as a login)' ) ); $form->email->addValidator('EmailAddress', true, array( 'messages' => array( Zend_Validate_EmailAddress::INVALID => 'Email Address is wrong', Zend_Validate_EmailAddress::INVALID_FORMAT => 'Email Address is wrong', ), 'domain' => false, )); $emailValidator = new Qs_Validate_Unique($this->dataObj->table, 'email', $this->dataObj->getPrimaryKey()); $emailValidator->setMessage('Email must be unique', Qs_Validate_Unique::NOT_UNIQUE); $form->email->addValidator($emailValidator); $this->_bindPasswordFields($form); return $this; } protected function _bindPasswordFields($form) { $form->addElement('password', 'password', array('label' => 'Password')); $form->addElement('password', 'confirmPassword', array('label' => 'Confirm Password')); $form->password->addValidator('ConfirmPassword', false, array('confirmPassword')); return $this; } }