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 (qiang.xue@gmail.com)
Наследование: extends TBaseValidator
Пример #1
0
 /**
  * Ensure that the ID attribute is rendered and registers the javascript code
  * for initializing the active control.
  */
 protected function addAttributesToRender($writer)
 {
     parent::addAttributesToRender($writer);
     TBaseValidator::registerClientScriptValidator();
 }