PHP Класс Prado\Web\UI\WebControls\TCustomValidator

TCustomValidator performs user-defined validation (either server-side or client-side or both) on an input component. To create a server-side validation function, provide a handler for the {@link onServerValidate OnServerValidate} event that performs the validation. The data string of the input control to validate can be accessed by {@link TServerValidateEventParameter::getValue Value} of the event parameter. The result of the validation should be stored in the {@link TServerValidateEventParameter::getIsValid IsValid} property of the event parameter. To create a client-side validation function, add the client-side validation javascript function to the page template. The function should have the following signature: Use the {@link setClientValidationFunction ClientValidationFunction} property to specify the name of the client-side validation script function associated with the TCustomValidator.
С версии: 3.0
Автор: Qiang Xue ([email protected])
Наследование: extends TBaseValidator
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
evaluateIsValid ( ) : boolean This method overrides the parent's implementation.
getClientValidationFunction ( ) : string
getValidationTarget ( ) : TControl
onServerValidate ( $value ) : boolean This method is invoked when the server side validation happens.
setClientValidationFunction ( $value ) Sets the name of the custom client-side script function used for validation.

Защищенные методы

Метод Описание
getClientClassName ( ) : string Gets the name of the javascript class responsible for performing validation for this control.
getClientScriptOptions ( ) : array Returns an array of javascript validator options.
registerClientScriptValidator ( ) Only register the client-side validator if {@link setClientValidationFunction ClientValidationFunction} is set.

Описание методов

evaluateIsValid() публичный метод

The validation succeeds if {@link onServerValidate} returns true.
public evaluateIsValid ( ) : boolean
Результат boolean whether the validation succeeds

getClientClassName() защищенный метод

This method overrides the parent implementation.
protected getClientClassName ( ) : string
Результат string the javascript class name

getClientScriptOptions() защищенный метод

Returns an array of javascript validator options.
protected getClientScriptOptions ( ) : array
Результат array javascript validator options.

getClientValidationFunction() публичный метод

public getClientValidationFunction ( ) : string
Результат string the name of the custom client-side script function used for validation.

getValidationTarget() публичный метод

public getValidationTarget ( ) : TControl
Результат TControl control to be validated. Null if no control is found.

onServerValidate() публичный метод

It will raise the OnServerValidate event. The method also allows derived classes to handle the event without attaching a delegate. Note The derived classes should call parent implementation to ensure the OnServerValidate event is raised.
public onServerValidate ( $value ) : boolean
Результат boolean whether the value is valid

registerClientScriptValidator() защищенный метод

Only register the client-side validator if {@link setClientValidationFunction ClientValidationFunction} is set.

setClientValidationFunction() публичный метод

Sets the name of the custom client-side script function used for validation.
public setClientValidationFunction ( $value )