PHP Class Prado\Web\UI\WebControls\TListControlValidator

TListControlValidator checks the number of selection and their values for a TListControl that allows multiple selection. You can specify the minimum or maximum (or both) number of selections required using the {@link setMinSelection MinSelection} and {@link setMaxSelection MaxSelection} properties, respectively. In addition, you can specify a comma separated list of required selected values via the {@link setRequiredSelections RequiredSelections} property. Examples - At least two selections - "value1" must be selected and at least 1 other
Since: 3.0
Inheritance: extends TBaseValidator
ファイルを表示 Open project: pradosoft/prado

Public Methods

Method Description
getMaxSelection ( ) : integer
getMinSelection ( ) : integer
getRequiredSelections ( ) : string Get a comma separated list of required selected values.
setMaxSelection ( $value )
setMinSelection ( $value )
setRequiredSelections ( $value ) Set the list of required values, using aa comma separated list.

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.
getRequiredValues ( ) : array
getSelection ( $control ) : array

Method Details

evaluateIsValid() protected method

The validation succeeds if the input component changes its data from the InitialValue or the input component is not given.
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.

getMaxSelection() public method

public getMaxSelection ( ) : integer
return integer max number of selections. Defaults to -1, meaning not set.

getMinSelection() public method

public getMinSelection ( ) : integer
return integer min number of selections. Defaults to -1, meaning not set.

getRequiredSelections() public method

Get a comma separated list of required selected values.
public getRequiredSelections ( ) : string
return string comma separated list of required values.

getRequiredValues() protected method

protected getRequiredValues ( ) : array
return array list of required values.

getSelection() protected method

protected getSelection ( $control ) : array
return array number of selected values and its values.

setMaxSelection() public method

public setMaxSelection ( $value )

setMinSelection() public method

public setMinSelection ( $value )

setRequiredSelections() public method

Set the list of required values, using aa comma separated list.
public setRequiredSelections ( $value )