I have posted about this in another thread but I think it deserves one of its own.
Say I have a select element that I want to output in my form - the basic HTML output to the browser would be:
<select id="gender" name="gender">
<option value="male">Male</option>
<option value="female">Female</option>
<option value="Undisclosed">Undisclosed</option>
</select>
Now suppose I want to have the ’Undisclosed’ option selected by default rather than the ’Male’ option which would be displayed using the code above. I would want to have the following HTML output to the browser:
<select id="gender" name="gender">
<option value="male">Male</option>
<option value="female">Female</option>
<option value="Undisclosed" selected>Undisclosed</option>
</select>
Now the important thing here is the ’selected’ attribute in the ’undisclosed’ option. In my experiments with eform the form parser seems to strip out that attribute no matter what way I enter it. I’ve tried:
selected
selected="selected"
selected='selected' (which is the way eform itself seems to reprint the selected option in the select element when validation is unsuccessful).
selected="true"
selected="yes"
The attribute is removed from both eforms based on a chunk template and ones based on snippets.
Any suggestions?