/** * Validate the entire form data set against each field's validators, and additionally validate interdependent fields. * * @return boolean True if each of the container's fields validates, and additionally if the dependencies validate; otherwise false. */ public function isValid() { $valid = parent::isValid(); $setPasswordField = $this->getField('setpass'); if (!$setPasswordField->hasErrorMessage() && $setPasswordField->getData()) { $passwordField = $this->getField('pass'); if (!$this->passwordLengthValidator->isValid($passwordField->getData())) { $passwordField->setErrorMessage($this->passwordLengthValidator->getErrorMessage()); } $passwordAgainField = $this->getField('passagain'); if (!$passwordField->hasErrorMessage() && !$passwordAgainField->hasErrorMessage()) { $password = $passwordField->getData(); $passwordAgain = $passwordAgainField->getData(); if ($passwordAgain != $password) { $valid = false; $passwordAgainField->setErrorMessage($this->__('The value entered does not match the password entered in the password field.')); } } } $emailField = $this->getField('email'); if (!$emailField->hasErrorMessage()) { $emailAgainField = $this->getField('emailagain'); $email = $emailField->getData(); $emailAgain = $emailAgainField->getData(); if ($email != $emailAgain) { $valid = false; $emailAgainField->setErrorMessage($this->__('The value entered does not match the e-mail address entered in the e-mail address field.')); } } return $valid; }
/** * Validate the entire form data set against each field's validators, and additionally validate interdependent fields. * * @return boolean True if each of the container's fields validates, and additionally if the dependencies validate; otherwise false. */ public function isValid() { $valid = parent::isValid(); $passwordField = $this->getField('pass'); $passwordAgainField = $this->getField('passagain'); if (!$passwordField->hasErrorMessage() && !$passwordAgainField->hasErrorMessage()) { $password = $passwordField->getData(); $passwordAgain = $passwordAgainField->getData(); if ($passwordAgain != $password) { $valid = false; $passwordAgainField->setErrorMessage($this->__('The value entered does not match the password entered in the password field.')); } } $emailField = $this->getField('email'); if (!$emailField->hasErrorMessage()) { $emailAgainField = $this->getField('emailagain'); $email = $emailField->getData(); $emailAgain = $emailAgainField->getData(); if ($email != $emailAgain) { $valid = false; $emailAgainField->setErrorMessage($this->__('The value entered does not match the e-mail address entered in the e-mail address field.')); } } $antispamQuestion = $this->getVar(UsersConstant::MODVAR_REGISTRATION_ANTISPAM_QUESTION, ''); if (!empty($antispamQuestion)) { $antispamAnswer = $this->getVar(UsersConstant::MODVAR_REGISTRATION_ANTISPAM_ANSWER, ''); $antiSpamAnswerField = $this->getField('antispamanswer'); if ($antiSpamAnswerField->getData() != $antispamAnswer) { $valid = false; $antiSpamAnswerField->setErrorMessage($this->__f('You did not provide the correct answer for the security question. The correct answer is \'%1$s\' (not including the quotes).', array($antispamAnswer))); } } return $valid; }
/** * Validate the entire form data set against each field's validators, and additionally validate interdependent fields. * * @return boolean True if each of the container's fields validates, and additionally if the dependencies validate; otherwise false. */ public function isValid() { $valid = parent::isValid(); $emailField = $this->getField('email'); if (!$emailField->hasErrorMessage()) { $emailAgainField = $this->getField('emailagain'); $email = $emailField->getData(); $emailAgain = $emailAgainField->getData(); if ($email != $emailAgain) { $valid = false; $emailAgainField->setErrorMessage($this->__('The value entered does not match the e-mail address entered in the e-mail address field.')); } } return $valid; }
/** * Validate the entire form data set against each field's validators, and additionally validate interdependent fields. * * @return boolean True if each of the container's fields validates, and additionally if the dependencies validate; otherwise false. */ public function isValid() { $valid = parent::isValid(); $antiSpamAnswerField = $this->getField(UsersConstant::MODVAR_REGISTRATION_ANTISPAM_ANSWER); if (!$antiSpamAnswerField->hasErrorMessage()) { $antiSpamAnswer = $antiSpamAnswerField->getData(); $antiSpamQuestionField = $this->getField(UsersConstant::MODVAR_REGISTRATION_ANTISPAM_QUESTION); $antiSpamQuestion = $antiSpamQuestionField->getData(); if (isset($antiSpamQuestion) && !empty($antiSpamQuestion) && (!isset($antiSpamAnswer) || empty($antiSpamAnswer))) { $valid = false; $antiSpamAnswerField->setErrorMessage($this->__('If a spam protection question is provided, then a spam protection answer must also be provided.')); } } return $valid; }
/** * Retrieve the field form id (the form id combined with the field name, separated by an underscore). * * @return string The field's form id. */ public function getFieldId() { return $this->formContainer->getFormId() . '_' . $this->fieldId; }