Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shopifypartners/822dcb59c1cbdd3ecd77606cf04fcce1 to your computer and use it in GitHub Desktop.
Save shopifypartners/822dcb59c1cbdd3ecd77606cf04fcce1 to your computer and use it in GitHub Desktop.
Form error and form success Liquid for accessible Shopify themes - https://www.shopify.com/partners/blog/developing-shopify-themes-with-accessibility-in-mind
{% form ‘new_comment’, article %}
{{ form.errors | default_errors }}
<label for=”CommentAuthor” class=”hidden-label”>Name</label>
<input {% if form.errors contains 'author' %}class=”error”{% endif %} type=”text” name=”comment[author]” placeholder=”Name” id=”CommentAuthor” value=”{{ form.author }}”>
<label for=”CommentEmail” class=”hidden-label”>Email</label>
<input {% if form.errors contains 'email' %}class=”error”{% endif %} type=”email” name=”comment[email]” placeholder=”email” id=”CommentEmail” value=”{{ form.email }}” autocorrect=”off” autocapitalize=”off”>
{% endform %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment