Phorm/Field.class.php
/**
	 * On the first call, calls each validator on the field value, and returns
	 * true if each returned successfully, false if any raised a
	 * ValidationError. On subsequent calls, returns the same value as the
	 * initial call. If $reprocess is set to true (default: false), will
	 * call each of the validators again. Stores the "cleaned" value of the
	 * field on success.
	 *
	 * @param boolean $reprocess if true, ignores memoized result of initial call
	 * @return boolean true if the field's value is valid
	 * @see PhormField::$valid,PhormField::$imported,PhormField::$validators,PhormField::$errors
	 */
On the first call, calls each validator on the field value, and returns
true if each returned successfully, false if any raised a
ValidationError. On subsequent calls, returns the same value as the
initial call. If $reprocess is set to true (default: false), will
call each of the validators again. Stores the "cleaned" value of the
field on success.


On the first call calls each validator on the field value and returns true if each returned successfully false if any raised a ValidationError . On subsequent calls returns the same value as the initial call . If $reprocess is set to true ( default : false ) will call each of the validators again . Stores the " cleaned " value of the field on success .
public function is_valid($reprocess=false)
	{
		if( $reprocess || is_null($this->valid) )
		{
			$value = $this->prepare_value($this->value);
			$this->errors = array();
			$v = $this->validators;
			foreach( $v as $k => $f )
			{
				try
				{
					if ($f == 'required') { 
						$this->validate_required_field($value);
					} else {
						call_user_func($f, $value);
					}
				}
				catch( Phorm_ValidationError $e )
				{
					$rule_name = is_array($f) ? $f[1] : $f; 
					$this->errors[] = array( $rule_name, $this->lang->{$e->getMessage()} );
				}
			}
			if( $value !== '' )
			{
				try
				{
					$this->validate($value);
				}
				catch( Phorm_ValidationError $e )
				{
					$this->errors[] = array( strtolower(get_class($this)), $this->lang->{$e->getMessage()} );
				}
			}
			if( $this->valid = empty($this->errors) )
			{
				$this->imported = $this->import_value($value);
			}
		}
		return $this->valid;
	}
public function is_valid ( $ reprocess = false ) { if ( $ reprocess || is_null ( $ this -> valid ) ) { $ value = $ this -> prepare_value ( $ this -> value ) ; $ this -> errors = array ( ) ; $ v = $ this -> validators ; foreach ( $ v as $ k => $ f ) { try { if ( $ f == 'required' ) { $ this -> validate_required_field ( $ value ) ; } else { call_user_func ( $ f , $ value ) ; } } catch ( Phorm_ValidationError $ e ) { $ rule_name = is_array ( $ f ) ? $ f [ 1 ] : $ f ; $ this -> errors [ ] = array ( $ rule_name , $ this -> lang -> { $ e -> getMessage ( ) } ) ; } } if ( $ value !== '' ) { try { $ this -> validate ( $ value ) ; } catch ( Phorm_ValidationError $ e ) { $ this -> errors [ ] = array ( strtolower ( get_class ( $ this ) ) , $ this -> lang -> { $ e -> getMessage ( ) } ) ; } } if ( $ this -> valid = empty ( $ this -> errors ) ) { $ this -> imported = $ this -> import_value ( $ value ) ; } } return $ this -> valid ; }
On the first call, calls each validator on the field value, and returns
 true if each returned successfully, false if any raised a
 ValidationError.
On the first call calls each validator on the field value and returns true if each returned successfully false if any raised a ValidationError .
// Pre-process value //special case -- available to all field types, and $this->validate() isn't even called if value is empty //handles both string (function name) and array (instance, function name)