Design and CSS styles
Version 6.x > Design and CSS styles > Label for Custom Form Control being rendered as a span instead of label View modes: 
User avatar
Member
Member
Nesfuratu - 1/30/2012 7:15:50 PM
   
Label for Custom Form Control being rendered as a span instead of label
I recently created a custom form control with the below in the front end.


<asp:CheckBox ID="chkParentalApproval" runat="server" ClientIDMode="Static" />
<cms:LocalizedLabel ID="lblParentalApproval" AssociatedControlID="chkParentalApproval" EnableViewState="false" runat="server" ResourceString="ParentalApproval.ValidationError" />


And have set it up with Attribute type: Boolean, Form Control type: Input. And in the bizform, I'm doing the custom layout and used:


$$input:WordsParentalApproval$$
$$label:WordsParentalApproval$$


However, the label that is created becomes a span instead of a label that links to the checkbox. Am I doing something wrong? Or is this a bug? How else should I set it up?

Thanks,
John.

User avatar
Kentico Support
Kentico Support
kentico_janh - 1/31/2012 3:02:01 AM
   
RE:Label for Custom Form Control being rendered as a span instead of label
Hello,

Yes, this is by design, because our Form engine checks, if there is no lable already associated with the control and if there is, then the label definition in the alternative form layout is changed to a span element. So please remove the $$label:WordsParentalApproval$$ string from alternative form layout or remove your <cms:LocalizedLabel /> element from your custom form control.

Best regards,
Jan Hermann

User avatar
Member
Member
Nesfuratu - 1/31/2012 7:23:06 PM
   
RE:Label for Custom Form Control being rendered as a span instead of label
Ah, that makes sense then. Thanks.