spunQ_DateRangeValidator Class Reference

Validator for date ranges in forms & fields. More...

Inheritance diagram for spunQ_DateRangeValidator:

spunQ_IFieldValidator spunQ_IFormValidator

List of all members.

Public Member Functions

 __construct ($firstParameterName= 'from', $secondParameterName= 'to')
 Constructor.
 validate ($messagePrefix, $value)
 Does the validation.
 showJsValidationString ($typePath, $messagePrefix)
 Prints javascript for this validator.
 validateForm (spunQ_Form $form)
 Validates the form.

Protected Attributes

 $firstParameterName
 Name of the first DateField in the range.
 $secondParameterName
 Name of the second DateField in the range.


Detailed Description

Validator for date ranges in forms & fields.

Makes sure that the first date precedes the second date.

Definition at line 7 of file DateRangeValidator.class.php.


Constructor & Destructor Documentation

spunQ_DateRangeValidator::__construct ( firstParameterName = 'from',
secondParameterName = 'to' 
)

Constructor.

Parameters:
$firstParameterName Name of the first DateField in the range. The name of a field in the FieldGroup/Form to be used.
$firstParameterName Name of the second DateField in the range.

Definition at line 29 of file DateRangeValidator.class.php.


Member Function Documentation

spunQ_DateRangeValidator::showJsValidationString ( typePath,
messagePrefix 
)

Prints javascript for this validator.

Should make use a call to the spunQ javascript function spunQ.form.registerValidator().

Parameters:
$messagePrefix A string to prepend to the error message key.
Returns:
boolean Whether any validation javascript was displayed.

Implements spunQ_IFieldValidator.

Definition at line 53 of file DateRangeValidator.class.php.

spunQ_DateRangeValidator::validate ( messagePrefix,
value 
)

Does the validation.

Parameters:
$messagePrefix A string to prepend to the error message key.
$value The spunQ value to validate.
Returns:
string Error message for the validated field, or NULL if the value was valid.

Implements spunQ_IFieldValidator.

Definition at line 38 of file DateRangeValidator.class.php.

spunQ_DateRangeValidator::validateForm ( spunQ_Form form  ) 

Validates the form.

Returns:
array<string> Array of error messages to be displayed. If the array is empty, no errors were encountered.

Implements spunQ_IFormValidator.

Definition at line 60 of file DateRangeValidator.class.php.


Member Data Documentation

spunQ_DateRangeValidator::$firstParameterName [protected]

Name of the first DateField in the range.

The name of a field in the FieldGroup/Form to be used.

Type:
string

Definition at line 14 of file DateRangeValidator.class.php.

spunQ_DateRangeValidator::$secondParameterName [protected]

Name of the second DateField in the range.

See also:
$firstParameterName
Type:
string

Definition at line 21 of file DateRangeValidator.class.php.


The documentation for this class was generated from the following file:

Generated on Fri Jul 1 11:12:39 2011 for spunQ3 by  doxygen 1.5.9