[ Index ] |
|
Code source de LifeType 1.2.4 |
[Code source] [Imprimer] [Statistiques]
\defgroup Forms The Form class helps in data validation.
Poids: | 260 lignes (7 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 2 fois |
Nécessite: | 0 fichiers |
FormValidator:: (14 méthodes):
FormValidator()
registerFieldValidator()
setFieldErrorMessage()
validate()
registerField()
isFieldValid()
getFormValidationResults()
getFieldValues()
formIsValid()
setFormIsValid()
setFieldValidationStatus()
formHasRun()
getFieldErrorMessage()
dump()
Classe: FormValidator - X-Ref
\ingroup FormsFormValidator() X-Ref |
initializes the form validator |
registerFieldValidator( $fieldName, $validatorClass, $onlyIfAvailable = false ) X-Ref |
registers a new validator, for validating data coming from fields param: fieldName The name of the field from the form that we're going to validate param: validator A valid class inheriting from the Validator base class and that implements param: onlyIfAvailable validate this field only if its value is not emtpy return: Always true |
setFieldErrorMessage( $fieldName, $errorMessage ) X-Ref |
it is also possible to specify custom error messages from within the php code, instead of leaving it up to the templates to decide which error message to show param: fieldName param: errorMessage return: Always true |
validate( $request ) X-Ref |
validates the data in the field return: True if all the fields validate or false otherwise |
registerField( $fieldName ) X-Ref |
forces a field to be true param: fieldName return: always true |
isFieldValid( $field ) X-Ref |
returns whether the field was validated successfully or not. Do not use this method *before* calling FormValidator::validate() param: field The name of the field in the form return: True if it validates or false otherwise |
getFormValidationResults() X-Ref |
returns an array where the field name is the key and the value will be either '0' or '1' depending on whether the field validated successfully or not return: An associative array |
getFieldValues() X-Ref |
returns an array where the key is the field and the value is the value of the field, but it will only contain those fields which have been registered return: An associative array |
formIsValid() X-Ref |
returns whether the form is valid or not return: a boolean |
setFormIsValid( $valid ) X-Ref |
changes the form validation status param: valid |
setFieldValidationStatus( $fieldName, $newStatus ) X-Ref |
changes the processing status of a field param: fieldName return: True |
formHasRun() X-Ref |
returns true if the form has already been executed (if FormValidator::validate() has already been called or not) Use this function when performing validatdion of data in your templates, since otherwise FormValidator::fieldIsValid and FormValidator::formIsValid() will always return false if validate() has not been called! return: returns true if the form has already been validated, or false otherwise |
getFieldErrorMessage( $fieldName ) X-Ref |
returns the custom error message for the field, if any param: fieldName |
dump() X-Ref |
dumps the current status of the form, useful for debugging purposes when we know that a field is not validating correctly but there is no error message displayed on the screen |
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |