ChoiceFormField
class ChoiceFormField extends FormField
ChoiceFormField represents a choice form field.
It is constructed from a HTML select tag, or a HTML checkbox, or radio inputs.
Properties
protected DOMElement | $node | from FormField | |
protected string | $name | from FormField | |
protected string | $value | from FormField | |
protected DOMDocument | $document | from FormField | |
protected DOMXPath | $xpath | from FormField | |
protected bool | $disabled | from FormField |
Methods
DOMElement|null
getLabel()
Returns the label tag associated to the field or null if none.
from FormField
setValue(string $value)
Sets the value of the field.
bool
hasValue()
Returns true if the field should be included in the submitted values.
bool
isDisabled()
Check if the current selected option is disabled.
initialize()
Initializes the form field.
select(string|array $value)
Sets the value of the field.
tick()
Ticks a checkbox.
untick()
Unticks a checkbox.
string
getType()
Returns the type of the choice field (radio, select, or checkbox).
bool
isMultiple()
Returns true if the field accepts multiple values.
bool
containsOption(string $optionValue, array $options)
Checks whether given value is in the existing options.
array
availableOptionValues()
Returns list of available field options.
disableValidation()
Disables the internal validation of the field.