Bug #5020
SelectViewHelper produces invalid code
Status: | Resolved | Start date: | 2009-10-17 | |
---|---|---|---|---|
Priority: | Must have | Due date: | ||
Assigned To: | Bastian Waidelich | % Done: | 100% |
|
Category: | ViewHelpers | |||
Target version: | - | |||
Has patch: | Affected Flow version: |
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
Associated revisions
[~BUGFIX] Fluid (ViewHelpers): Fixed the Select view helper to always create at least one option element. This fixes #5020
History
#1 Updated by Bastian Waidelich almost 6 years ago
- Project changed from Extbase MVC Framework to TYPO3.Fluid
- Category deleted (
432)
#2 Updated by Bastian Waidelich almost 6 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?
#3 Updated by Karsten Dambekalns almost 6 years ago
To fix the issue one could add one option with "---" as a last resort.
#4 Updated by Bastian Waidelich almost 6 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
#5 Updated by Bastian Waidelich almost 6 years ago
- Assigned To set to Bastian Waidelich
#6 Updated by Bastian Waidelich over 5 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset r3512.