Class \Prado\Web\UI\WebControls\TListControlValidator
TListControlValidator class.
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 \Prado\Web\UI\WebControls\setMinSelection and \Prado\Web\UI\WebControls\setMaxSelection properties, respectively. In addition, you can specify a comma separated list of required selected values via the \Prado\Web\UI\WebControls\setRequiredSelections property.
Examples
- At least two selections
<com:TListBox ID="listbox" SelectionMode="Multiple">
<com:TListItem Text="item1" Value="value1" />
<com:TListItem Text="item2" Value="value2" />
<com:TListItem Text="item3" Value="value3" />
</com:TListBox>
<com:TListControlValidator
ControlToValidate="listbox"
MinSelection="2"
ErrorMessage="Please select at least 2" />
- "value1" must be selected and at least 1 other
<com:TCheckBoxList ID="checkboxes">
<com:TListItem Text="item1" Value="value1" />
<com:TListItem Text="item2" Value="value2" />
<com:TListItem Text="item3" Value="value3" />
</com:TCheckBoxList>
<com:TListControlValidator
ControlToValidate="checkboxes"
RequiredSelections="value1"
MinSelection="2"
ErrorMessage="Please select 'item1' and at least 1 other" />
Class hierarchy
- \Prado\Web\UI\WebControls\TListControlValidator
- \Prado\Web\UI\WebControls\TBaseValidator implements IValidator
- \Prado\Web\UI\WebControls\TLabel implements IDataRenderer
- \Prado\Web\UI\WebControls\TWebControl implements IStyleable
- \Prado\Web\UI\TControl implements IRenderable, IBindable
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.0
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
setRequiredSelections(string $value) : mixed
Set the list of required values, using aa comma separated list.
|
protected
|
evaluateIsValid() : bool
This method overrides the parent's implementation.
The validation succeeds if the input component changes its data from the InitialValue or the input component is not given. |
protected
|
getClientClassName() : string
Gets the name of the javascript class responsible for performing validation for this control.
This method overrides the parent implementation. |
protected
|
getClientScriptOptions() : array<string|int, mixed>
Returns an array of javascript validator options.
|
protected
|
|
protected
|