src/Elements/Parents/Field.php
public function validate()
	{
		$this->errors = array();
		$value = $this->getRawValue();

		if ($this->required) {

			$passed = $this->validateRequired($value);

			// don't do anymore validation until it passes the required validation
			if (!$passed) return $this->errors;

			// validate by field type
			$this->validateType($value);

			// validate by pattern, if defined
			$this->validatePattern($value);

      // validate by maxlength, if defined
      $this->validateMaxLength($value);

			// hook for users?

		}

		return $this->errors;
	}
public function validate()
	{
		$this->errors = array();
		$value = $this->getRawValue();

		if ($this->required) {

			$passed = $this->validateRequired($value);

			// don't do anymore validation until it passes the required validation
			if (!$passed) return $this->errors;

			// validate by field type
			$this->validateType($value);

			// validate by pattern, if defined
			$this->validatePattern($value);

      // validate by maxlength, if defined
      $this->validateMaxLength($value);

			// hook for users?

		}

		return $this->errors;
	}
public function validate ( ) { $ this -> errors = array ( ) ; $ value = $ this -> getRawValue ( ) ; if ( $ this -> required ) { $ passed = $ this -> validateRequired ( $ value ) ; // don't do anymore validation until it passes the required validation if ( ! $ passed ) return $ this -> errors ; // validate by field type $ this -> validateType ( $ value ) ; // validate by pattern, if defined $ this -> validatePattern ( $ value ) ; // validate by maxlength, if defined $ this -> validateMaxLength ( $ value ) ; // hook for users? } return $ this -> errors ; }
Validate a field
@return boolean TRUE is valid; FALSE if invalid
Validate a field