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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

generated OptionsetField HTML code not valid HTML5?


Go to End


3 Posts   1086 Views

Avatar
danzzz

Community Member, 175 Posts

14 April 2012 at 4:16am

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

Forum Moderator, 5523 Posts

14 April 2012 at 11:56am

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

Community Member, 175 Posts

17 April 2012 at 6:52pm