Bug #5020
SelectViewHelper produces invalid code
100%
Description
The Select View Helper produces invalid code with strange output, if the value of the attribute "options" is empty. This is caused by the lack of at least one OPTION element.
"A SELECT element must contain at least one OPTION element."
http://www.w3.org/TR/html4/interact/forms.html#h-17.6
Updated by Bastian Waidelich over 12 years ago
- Project changed from 534 to TYPO3.Fluid
- Category deleted (
432)
Updated by Bastian Waidelich over 12 years ago
- Category set to ViewHelpers
- Branch set to v4 + v5
What do you suggest as solution?
Always add <option value=""></option>
if options array is empty?
I'd prefer to have some prependOptions
or appendOptions
argument, so you could write
<f:form.select name="paymentOptions" options="{settings.paymentOptions}" prependOptions="{0: ' - choose one - '}" />
What do you think?
Updated by Karsten Dambekalns over 12 years ago
To fix the issue one could add one option with "---" as a last resort.
Updated by Bastian Waidelich over 12 years ago
Karsten Dambekalns wrote:
To fix the issue one could add one option with "---" as a last resort.
Ok, I'll take care of this. But I'd rather add an empty option (<option></option>
) in case the $options array is empty.
Anyways, what do you think about the prependOptions attribute?
Bastian
Updated by Bastian Waidelich over 12 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset r3512.