Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
hello ... I have a form which includes a radio button:

Code: Select all
<div class="form-group<cms:if k_error_sendmeacopy> has-feedback</cms:if>">
<label class="control-label" for="sendmeacopy">Would you like a copy of this form to be emailed to you?</label><br>
<cms:input type="radio"
name="sendmeacopy"
opt_values='Yes=y | No=n'
opt_selected='y'
required='1'
/>
<cms:if k_error_sendmeacopy><span class="glyphicon glyphicon-remove form-control-feedback"></span><span class="k-error"><cms:show k_error_sendmeacopy /></span></cms:if>
</div>       


I just sent the page through the W3C validator and am getting an error "The for attribute of the label element must refer to a form control. …ass="control-label" for="sendmeacopy0">Would you like a copy of this form to b…"

The Couch tag is generating the HTML:
Code: Select all
<div class="form-group">
<label class="control-label" for="sendmeacopy">Would you like a copy of this form to be emailed to you?</label><br>
<label><input name="sendmeacopy" id="sendmeacopy0" value="y" checked="checked" type="radio">Yes</label>
<label><input name="sendmeacopy" id="sendmeacopy1" value="n" type="radio">No</label>
</div>     


I guess it's the wrapping of the <input> inside <label> that is causing the error. Whilst I don't want to be a sad nitpicking slave to the W3C validator (!) - I'm wondering if there is a reason for Couch behaving like this? Or is it something I've done?
Hi @potato,

I suppose the only way to assuage the W3C validator would be to change the generated HTML.

I am adding this to the open issues and will make the changes in the next version.

Thanks for the heads-up :)
If it's in TODO list I'd like to add another issue here to change: please, don't wrap <input> in <label>, just serve them as siblings, with "for" attributes for labels. This way is more correct and better customizable

Thanks!
You got it :)
Changing the markup to make the label and input elements siblings would be a breaking change. I'm partial to just adding the for attribute to the label.
5 posts Page 1 of 1