spunQ_StringLengthValidator Class Reference

Validates string lengths for UTF-8 strings. More...

Inheritance diagram for spunQ_StringLengthValidator:

spunQ_FieldValidator spunQ_IFieldValidator

List of all members.

Public Member Functions

 __construct ($min=NULL, $max=NULL, $messageKey= 'InvalidLength')
 Constructor.
 validate ($messagePrefix, $value)
 Does the validation.
 showJsValidationString ($typePath, $messagePrefix)
 Prints javascript for this validator.

Protected Attributes

 $min
 Minimum string length.
 $max
 Maximum string length.
 $messageKey
 Translation key for the error message.


Detailed Description

Validates string lengths for UTF-8 strings.

Definition at line 6 of file StringLengthValidator.class.php.


Constructor & Destructor Documentation

spunQ_StringLengthValidator::__construct ( min = NULL,
max = NULL,
messageKey = 'InvalidLength' 
)

Constructor.

Parameters:
$min Minimum string length.
$max Maximum string length.
$messageKey Translation key for the error message to be displayed if the value is invalid. The translation will recieve three parameters: actual string length, minimum string length and maximum string length.

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


Member Function Documentation

spunQ_StringLengthValidator::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.

Reimplemented from spunQ_FieldValidator.

Definition at line 62 of file StringLengthValidator.class.php.

spunQ_StringLengthValidator::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 39 of file StringLengthValidator.class.php.


Member Data Documentation

spunQ_StringLengthValidator::$max [protected]

Maximum string length.

Type:
integer

Definition at line 18 of file StringLengthValidator.class.php.

spunQ_FieldValidator::$messageKey [protected, inherited]

Translation key for the error message.

Type:
string

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

spunQ_StringLengthValidator::$min [protected]

Minimum string length.

Type:
integer

Definition at line 12 of file StringLengthValidator.class.php.


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

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