Concrete5.7.5.2 - How to set selected option in select box?
Permalink
I use the following code for a select box:
But I can't find any information where I can set one of my options to 'selected' property, for example:
Anyone know? Thank you.
$form->select($name, $options, $value, $tagAttributes)
But I can't find any information where I can set one of my options to 'selected' property, for example:
<option value="http://mysite.com" selected>My Site</option>
Anyone know? Thank you.
Thank you for your reply.
From the w3schools website:http://www.w3schools.com/tags/att_option_selected.asp...
<option selected>
Differences Between HTML 4.01 and HTML5
NONE.
Differences Between HTML and XHTML
In XHTML, attribute minimization is forbidden, and the selected attribute must be defined as <option selected="selected">.
Which is the correct way in C5.7?
From the w3schools website:http://www.w3schools.com/tags/att_option_selected.asp...
<option selected>
Differences Between HTML 4.01 and HTML5
NONE.
Differences Between HTML and XHTML
In XHTML, attribute minimization is forbidden, and the selected attribute must be defined as <option selected="selected">.
Which is the correct way in C5.7?
The Form widget will add "selected="selected"" to the option element that is true.
Example:
When you first use the select widget, $select_example has no value.
Selecting "turnip" from the select, then saving. The value of $select_example is "turnip".