Example #1
0
 /**
  * Sets the regular expression that is used to validate the text field.
  *
  * @param string $regexp The regular expression
  */
 public function setRegExp($regexp)
 {
     $this->type = "REGEXP";
     $this->regexp = $regexp;
     $this->addJsValidation(array("func" => "fapiCheckRegexp", "regexp" => "/" . $regexp . "/", "message" => Field::prepareMessage("This {$this->getLabel()} format is not valid")));
     return $this;
 }
Example #2
0
 /**
  * Sets the required status of the field.
  *
  * @param The required status of the field.
  */
 public function setRequired($required)
 {
     //$this->addAttribute("onblur","fapiCheckRequired('".$this->getId()."')");
     $this->addJsValidation(array("func" => "fapiCheckRequired", "message" => Field::prepareMessage($this->getLabel() . " is required.")));
     $this->required = $required;
     return $this;
 }