Forums

For attribute in label

tubantix 20 Nov, 2010
Hello,

To make a form fully accessible, the label-tag needs a for="" attribute. When one clicks on the label, the cursor appears in the input field. The value in the for-attribute must be the same as the input id.
Is there a easy (automatic) way to add the for-attribute in ChronoForms? Or do I have to do it manually in the form editor?

Chronoforms is a great form-component! Thank you very much!

Regards,
GreyHead 20 Nov, 2010
Hi tubantix,

There's no immediately automatic way. I notice that the 'theme1' does it correctly though (see the "Transform Form" icon) so you could presumably edit the default theme to include the 'for' attribute.

Bob
tubantix 20 Nov, 2010
Hello Bob,

Thank you very much for your reply.
Is there a way to insert a for-attribute in the code of the component with the same variable as the input-id? Or is it more complicated than that? (I'm not a php developer 😶 ) Preferable for text fields and area's.

Thank you very much,
GreyHead 20 Nov, 2010
Hi tubantix,

I just tested and you can make this change. Open the file administrator/components/com_chronocontact/themes/default/elements.php in a text editor. Look for the label lines: the one for the text input is line 39
    <label class="cf_label"{cf_labeloptions}>{cf_labeltext}</label>
then edit this to add the for attribute
    <label class="cf_label" for="{cf_id}"{cf_labeloptions} >{cf_labeltext}</label>

NB If you just change this file it may get overwritten when you upgrade ChronoForms so keep a backup copy, or copy the theme to a new folder and use that.

Bob
tubantix 20 Nov, 2010
That's great! Thank you very much for your help. And especially for the fast replies.
I'm developing a new website for a Belgian civil rights organisation for disabled people (people with a disability or what's the politicaly correct term? :wink: )
It's very important for their credibility that the website keeps its accessibility-label. For that we have to be very specific in every html detail.

Thanks again for the great service. This has been very helpful.😀
This topic is locked and no more replies can be posted.