/** * * Method to validate user inputs, if not: set field property isValid to false and set error message * @param string $inputType user input type (postValue, queryValue) */ protected function validateUserInput($inputType) { $type = $this->type; $value = $this->{$inputType}; //Empty value is valid if ($value == "") { return; } //if a value is set we test it is a valid number (which still may have dots and commas if (VisformsValidate::validate($type, array('value' => $value))) { return; } else { //invalid user inputs - set field->isValid to false $this->field->isValid = false; //set the Error Message VisformsMessage::getMessage($this->field->name, $type); return; } }
/** * * Constructor * * @param string $name field name * @param array $args additional arguments */ public function __construct($name, $args) { parent::__construct($name, $args); $this->text = 'COM_VISFORMS_FIELD_DATE_FORMAT'; $this->args = $args; }
/** * * Constructor * * @param string $name field name * @param array $args additional arguments */ public function __construct($name, $args) { parent::__construct($name, $args); $this->text = 'COM_VISFORMS_FIELD_NOT_A_NUMBER'; }
/** * * Constructor * * @param string $name field name * @param array $args additional arguments */ public function __construct($name, $args) { parent::__construct($name, $args); $this->text = 'COM_VISFORMS_FIELD_EMAIL_NOT_VALIDE'; }
/** * * Method to validate user inputs, if not: set field property isValid to false and set error message * @param string $inputType user input type (postValue, queryValue) */ protected function validateUserInput($inputType) { $type = $this->type; $value = $this->{$inputType}; //Empty value is valid if ($value == "") { return true; } //if a value is set we test it has a valid date format if (VisformsValidate::validate($type, array('value' => $value, 'format' => $this->field->dateFormatPhp))) { return true; } else { //invalid date format - set field->isValid to false $this->field->isValid = false; //set the Error Message VisformsMessage::getMessage($this->field->name, $type, array('format' => $this->field->dateFormatPhp)); //we cannot use the value! return false; } }