Jump to:

22979 Posts in 11815 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » generated OptionsetField HTML code not valid HTML5?

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

Page: 1
Go to End
Author Topic: 490 Views
  • danzzz
    Avatar
    Community Member
    175 Posts

    generated OptionsetField HTML code not valid HTML5? Link to this post

    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"

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: generated OptionsetField HTML code not valid HTML5? Link to this post

    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.

  • danzzz
    Avatar
    Community Member
    175 Posts
    490 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.