Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

Form labels lack for

Started by Martin Brampton 6 years ago · 1 replies · 458 views
6 years ago

I've deployed the sample "contact us" form. It seems that the generated HTML has labels but they appear not to have a "for" attribute to link the label to a form field. This is a negative for accessibility. Is there any way to make the form generate "for" attributes, short of writing the HTML?

6 years ago

That's no good at all! I looked into this and it seems the template in the forms plugin does set this to the id property/attribute for the field, but this is not set in the example contact form you mention.

Try adding the id property to the field's frontmatter.

So the example is simple, but not the best it could be. Please consider making or requesting a change to the documentation, as it's community maintained. Good find, thanks! :)

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1136 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 61 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 134 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 110 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 129 7 months ago