Prado\Web\UI\WebControls\TBaseValidator::registerClientScriptValidator PHP Method

registerClientScriptValidator() protected method

Registers the individual validator client-side javascript code.
    protected function registerClientScriptValidator()
    {
        $key = 'prado:' . $this->getClientID();
        if (!$this->getPage()->getClientScript()->isEndScriptRegistered($key)) {
            $options = TJavaScript::encode($this->getClientScriptOptions());
            $script = 'new ' . $this->getClientClassName() . '(' . $options . ');';
            $this->getPage()->getClientScript()->registerEndScript($key, $script);
        }
    }

Usage Example

 /**
  * 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();
 }
All Usage Examples Of Prado\Web\UI\WebControls\TBaseValidator::registerClientScriptValidator