Hi all,

I got the following error during validation of one of my forms today:

> The first child option element of a select element with a required
> attribute, and without a multiple attribute, and without a size
> attribute whose value is greater than 1, must have either an empty
> value attribute, or must have no text content. Consider either
> adding a placeholder option label, or adding a size attribute with a
> value equal to the number of option elements.

The message is about the following spec:

http://dev.w3.org/html5/spec-preview/the-select-element.html#placeholder-label-option

The reason for the error seems simple: I use a DropDownChoice with a
default selected value and null disallowed, so I always need a value.
In that case AbstractSingleSelectChoice.getDefaultChoice doesn't
provide any content, because there's already one value selected and
this is not null. That results in the select gets only rendered with
the choices provided, missing a default option with value "" and so
violating the HTML5 spec... The default option doesn't necessarily
needs to be selected, it just needs to exist if the select is
required.

To resolve this issue I extended DropDownChoice and implemented my own
getDefaultChoice, which simply always returns an option with value ""
if the base implementation returns an empty string.

Is this worth creating an issue in JIRA, either as bug or enhancement?

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail: [email protected]
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to