Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Form labels lack for

Started by Martin Brampton 7 years ago · 1 replies · 749 views
7 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?

7 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 Anna, 2 days ago
2 53 16 hours ago
Forms & Blueprints · by Anna, 3 days ago
7 82 16 hours ago
Forms & Blueprints · by Anna, 1 week ago
5 186 6 days ago
Forms & Blueprints · by TomW, 1 month ago
3 379 1 month ago
Forms & Blueprints · by Japhy, 2 months ago
2 595 2 months ago