Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

generated OptionsetField HTML code not valid HTML5?


Reply

3 Posts   617 Views

Avatar
danzzz

14 April 2012 at 4:16am Community Member, 175 Posts

hi,

checker on http://validator.w3.org/check says:

Line 289, Column 92: The for attribute of the label element must refer to a form control.
…lass="left" for="Form_LeadForm_Gender">Anrede</label><div class="middleColumn"…

and here the field or SS generated HTML code

<div id="Gender" class="field optionset "><label class="left" for="Form_LeadForm_Gender">Anrede</label><div class="middleColumn"><ul id="Form_LeadForm_Gender" class="optionset ">
<li class="odd valm"><input id="Form_LeadForm_Gender_m" name="Gender" type="radio" value="m" class="radio" /> <label for="Form_LeadForm_Gender_m">Herr</label></li>
<li class="even valf"><input id="Form_LeadForm_Gender_f" name="Gender" type="radio" value="f" class="radio" /> <label for="Form_LeadForm_Gender_f">Frau</label></li>
</ul>
</div></div>

the validation passes with

for="Form_LeadForm_Gender_m"

or

for="Form_LeadForm_Gender_f"

Avatar
Willr

14 April 2012 at 11:56am Forum Moderator, 5511 Posts

Good catch. The label in that case shouldn't have a for attribute. Submit it as a bug on open.silverstripe.org. I'm not sure how that'd be fixed (the label comes from the parent form holder) but we may need to introduce a new for attribute which is not set on Optionsetfields.

Avatar
danzzz

17 April 2012 at 6:52pm Community Member, 175 Posts

ok, done: http://open.silverstripe.org/ticket/7162