public function validate($deep = true) { // call parent parent::validate($deep); // save results return $this->finishValidation(); }
public function validate() { // call parent parent::validate(); $this->_validator->validate(array('field' => 'Title', 'errorMessage' => 'Please enter a title for your discussion')); // save results return $this->finishValidation(); }
public function validate($deep = true) { // call parent parent::validate($deep); $this->_validator->validate(array('field' => 'Handle', 'validator' => 'handle', 'errorMessage' => 'Handle can only contain letters, numbers, hyphens, and underscores')); // save results return $this->finishValidation(); }
public function validate($deep = true) { // call parent parent::validate($deep); // implement handles HandleBehavior::onValidate($this, $this->_validator); // save results return $this->finishValidation(); }
public function validate($deep = true) { // call parent parent::validate($deep); $this->_validator->validate(array('field' => 'Title', 'errorMessage' => 'A title is required')); // implement handles GlobalHandleBehavior::onValidate($this, $this->_validator); // save results return $this->finishValidation(); }
public function validate($deep = true) { // call parent parent::validate($deep); // check handle uniqueness if ($this->isFieldDirty('Code') && !$this->_validator->hasErrors('Code') && $this->Code) { $ExistingRecord = static::getByHandle($this->Code); if ($ExistingRecord && $ExistingRecord->ID != $this->ID) { $this->_validator->addError('Code', 'Code already registered'); } } // save results return $this->finishValidation(); }
public function validate($deep = true) { // call parent parent::validate($deep); // strip any non-digit characters from phone before validation if ($this->Phone) { $this->Phone = preg_replace('/\\D/', '', $this->Phone); } $this->_validator->validate(array('field' => 'Class', 'validator' => 'selection', 'choices' => self::$subClasses, 'required' => false)); $this->_validator->validate(array('field' => 'FirstName', 'minlength' => 2, 'required' => true, 'errorMessage' => 'First name is required.')); $this->_validator->validate(array('field' => 'LastName', 'minlength' => 2, 'required' => true, 'errorMessage' => 'Last name is required.')); $this->_validator->validate(array('field' => 'Email', 'validator' => 'email', 'required' => static::$requireEmail)); // check handle uniqueness if ($this->isDirty && !$this->_validator->hasErrors('Email') && $this->Email) { $ExistingUser = User::getByField('Email', $this->Email); if ($ExistingUser && $ExistingUser->ID != $this->ID) { $this->_validator->addError('Email', static::$existingEmailError); } } $this->_validator->validate(array('field' => 'Phone', 'validator' => 'phone', 'required' => static::$requirePhone)); $this->_validator->validate(array('field' => 'BirthDate', 'validator' => 'date_ymd', 'required' => static::$requireBirthDate)); $this->_validator->validate(array('field' => 'Gender', 'validator' => 'selection', 'required' => static::$requireGender, 'choices' => self::$fields['Gender']['values'])); // save results return $this->finishValidation(); }