Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Form labels lack for

Started by Martin Brampton 6 years ago · 1 replies · 597 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 FrViPofm, 4 days ago
5 84 4 days ago
Forms & Blueprints · by Ton Haarmans, 6 years ago
13 2113 7 months ago
Forms & Blueprints · by Hugo Oliveira, 8 months ago
0 596 8 months ago
Forms & Blueprints · by Flachy Joe, 9 months ago
9 687 9 months ago
Forms & Blueprints · by Augustus, 10 months ago
7 737 10 months ago