public function isValid($values) { if ($values["type"] == 1) { $inArr = array(); foreach ($this->_validatorArr() as $arr) { $inArr[] = $arr[0]; } $this->getElement("type")->addValidator(new Daq_Validate_InArray($inArr)); } if ($values["field_for"] == 2) { $this->getElement("type")->addOption(5, 5, ""); } $isValid = parent::isValid($values); if ($values["type"] == 4) { if (!isset($values['option']) || count($values['option']) < 1) { $this->getElement("type")->pushError(__("Field type of Dropdown has to have at least one option.", WPJB_DOMAIN)); return false; } foreach ($values['option'] as $option) { if (strlen(trim($option)) == 0) { $this->getElement("type")->pushError(__("One of options is empty", WPJB_DOMAIN)); return false; } } } return $isValid; }
public function isValid($values) { $isValid = parent::isValid($values); $ext = $this->getElement("company_logo")->getExt(); $value = $this->getValues(); if ($ext) { $e = new Daq_Form_Element("company_logo_ext"); $e->setValue($ext); $this->addElement($e); } return $isValid; }
public function _isValid($values) { if ($this->hasElement("resume_id") && is_numeric($values["resume_id"])) { $this->getElement("resume_id")->setValue($values["resume_id"]); $isValid = $this->getElement("resume_id")->validate(); } else { $isValid = parent::isValid($values); $e = __("You have to send CV file if you want to leave this field empty", WPJB_DOMAIN); if ($this->hasElement("cv_file") && $this->hasElement("cv_text")) { $file = $this->getElement("cv_file"); $text = $this->getElement("cv_text"); if (!$file->fileSent() && strlen(trim($text->getValue())) == 0) { $this->getElement("cv_text")->pushError($e); return false; } } } return $isValid; }
public function isValid($values) { $isValid = parent::isValid($values); $ext = null; if ($this->hasElement("image")) { $ext = $this->getElement("image")->getExt(); } $value = $this->getValues(); if ($ext) { $e = new Daq_Form_Element("image_ext"); $e->setValue($ext); $this->addElement($e); } return $isValid; }
public function isValid($values) { if ($values["type"] == 1) { $this->getElement("discount")->addValidator(new Daq_Validate_Float(0, 100)); } return parent::isValid($values); }