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.
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 |
__construct(DOMElement $node) | from FormField | |
DOMElement|null | getLabel() Returns the label tag associated to the field or null if none. | from FormField |
string | getName() Returns the name of the field. | from FormField |
string|array | getValue() Gets the value of the field. | 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. | ||
addChoice(DOMElement $node) Adds a choice to the current ones. | ||
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. | |
ChoiceFormField | disableValidation() Disables the internal validation of the field. |
DOMElement | $node | The node associated with this field |
Returns the label tag associated to the field or null if none.
DOMElement|null |
Returns the name of the field.
string | The name of the field |
Gets the value of the field.
string|array | The value of the field |
Sets the value of the field.
string | $value | The value of the field |
InvalidArgumentException | When value type provided is not correct |
Returns true if the field should be included in the submitted values.
bool | true if the field should be included in the submitted values, false otherwise |
Check if the current selected option is disabled.
bool |
Initializes the form field.
LogicException | When node type is incorrect |
Sets the value of the field.
string|array | $value | The value of the field |
Ticks a checkbox.
LogicException | When the type provided is not correct |
Unticks a checkbox.
LogicException | When the type provided is not correct |
Adds a choice to the current ones.
DOMElement | $node |
LogicException | When choice provided is not multiple nor radio |
Returns the type of the choice field (radio, select, or checkbox).
string | The type |
Returns true if the field accepts multiple values.
bool | true if the field accepts multiple values, false otherwise |
Checks whether given value is in the existing options.
string | $optionValue | |
array | $options |
bool |
Returns list of available field options.
array |
Disables the internal validation of the field.
ChoiceFormField |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/DomCrawler/Field/ChoiceFormField.html