PHP Class Prado\Web\UI\WebControls\TRequiredFieldValidator

TRequiredFieldValidator makes the associated input control a required field. The input control fails validation if its value does not change from the {@link setInitialValue InitialValue} property upon losing focus. Validation will also succeed if input is of TListControl type and the number of selected values different from the initial value is greater than zero. If the input is of TListControl type and has a {@link TListControl::setPromptValue PromptValue} set, it will be automatically considered as the validator's {@link setInitialValue InitialValue}.
Since: 3.0
Author: Qiang Xue ([email protected])
Inheritance: extends TBaseValidator
Show file Open project: pradosoft/prado Class Usage Examples

Public Methods

Method Description
getInitialValue ( ) : string
setInitialValue ( $value )

Protected Methods

Method Description
evaluateIsValid ( ) : boolean This method overrides the parent's implementation.
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.
getControlPromptValue ( ) : string

Private Methods

Method Description
validateListControl ( $control )
validateRadioButtonGroup ( $control )
validateStandardControl ( $control )

Method Details

evaluateIsValid() protected method

The validation succeeds if the input component changes its data from the {@link getInitialValue InitialValue} or the input control is not given. Validation will also succeed if input is of TListControl type and the number of selected values different from the initial value is greater than zero.
protected evaluateIsValid ( ) : boolean
return boolean whether the validation succeeds

getClientClassName() protected method

This method overrides the parent implementation.
protected getClientClassName ( ) : string
return string the javascript class name

getClientScriptOptions() protected method

Returns an array of javascript validator options.
protected getClientScriptOptions ( ) : array
return array javascript validator options.

getControlPromptValue() protected method

protected getControlPromptValue ( ) : string
return string the initial value of the associated input control. Defaults to empty string. If the associated input control does not change from this initial value upon postback, the validation fails.

getInitialValue() public method

public getInitialValue ( ) : string
return string the initial value of the associated input control. Defaults to empty string unless the control has a prompt value set. If the associated input control does not change from this initial value upon postback, the validation fails.

setInitialValue() public method

public setInitialValue ( $value )