Bug #5020

SelectViewHelper produces invalid code

Added by Jochen Rau over 12 years ago. Updated over 11 years ago.

Status:
Resolved
Priority:
Must have
Category:
ViewHelpers
Target version:
-
Start date:
2009-10-17
Due date:
% Done:

100%

Estimated time:
Has patch:

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

#1

Updated by Bastian Waidelich over 12 years ago

  • Project changed from 534 to TYPO3.Fluid
  • Category deleted (432)
#2

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?

#3

Updated by Karsten Dambekalns over 12 years ago

To fix the issue one could add one option with "---" as a last resort.

#4

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

#5

Updated by Bastian Waidelich over 12 years ago

  • Assignee set to Bastian Waidelich
#6

Updated by Bastian Waidelich over 12 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset r3512.

Also available in: Atom PDF