PHP Class Symfony\Component\DomCrawler\Field\ChoiceFormField

It is constructed from a HTML select tag, or a HTML checkbox, or radio inputs.
Author: Fabien Potencier ([email protected])
Inheritance: extends FormField
Show file Open project: symfony/dom-crawler Class Usage Examples

Public Methods

Method Description
addChoice ( DOMElement $node ) Adds a choice to the current ones.
availableOptionValues ( ) : array Returns list of available field options.
containsOption ( string $optionValue, array $options ) : boolean Checks whether given value is in the existing options.
disableValidation ( ) : self Disables the internal validation of the field.
getType ( ) : string Returns the type of the choice field (radio, select, or checkbox).
hasValue ( ) : boolean Returns true if the field should be included in the submitted values.
isDisabled ( ) : boolean Check if the current selected option is disabled.
isMultiple ( ) : boolean Returns true if the field accepts multiple values.
select ( string $value ) Sets the value of the field.
setValue ( string $value ) Sets the value of the field.
tick ( ) Ticks a checkbox.
untick ( ) Ticks a checkbox.

Protected Methods

Method Description
initialize ( ) Initializes the form field.

Private Methods

Method Description
buildOptionValue ( DOMElement $node ) : array Returns option value with associated disabled flag.

Method Details

addChoice() public method

Adds a choice to the current ones.
public addChoice ( DOMElement $node )
$node DOMElement

availableOptionValues() public method

Returns list of available field options.
public availableOptionValues ( ) : array
return array

containsOption() public method

Checks whether given value is in the existing options.
public containsOption ( string $optionValue, array $options ) : boolean
$optionValue string
$options array
return boolean

disableValidation() public method

Disables the internal validation of the field.
public disableValidation ( ) : self
return self

getType() public method

Returns the type of the choice field (radio, select, or checkbox).
public getType ( ) : string
return string The type

hasValue() public method

Returns true if the field should be included in the submitted values.
public hasValue ( ) : boolean
return boolean true if the field should be included in the submitted values, false otherwise

initialize() protected method

Initializes the form field.
protected initialize ( )

isDisabled() public method

Check if the current selected option is disabled.
public isDisabled ( ) : boolean
return boolean

isMultiple() public method

Returns true if the field accepts multiple values.
public isMultiple ( ) : boolean
return boolean true if the field accepts multiple values, false otherwise

select() public method

Sets the value of the field.
public select ( string $value )
$value string The value of the field

setValue() public method

Sets the value of the field.
public setValue ( string $value )
$value string The value of the field

tick() public method

Ticks a checkbox.
public tick ( )

untick() public method

Ticks a checkbox.
public untick ( )