Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save curvgrl5000/3366329 to your computer and use it in GitHub Desktop.
Save curvgrl5000/3366329 to your computer and use it in GitHub Desktop.
Shopify Contact form
{% form 'contact' %}
{% if form.posted_successfully? %}
<p class="success-msg">Thanks for contacting us! We'll get back to you as soon as possible.</p>
{% endif %}
{% if form.errors %}
<p class="error-msg">
<ul class="error-list" style="color:#E0360F">
{% for field in form.errors %}
{% if field == 'body' %}
<li>Your message cannot be blank.</li>
{% endif %}
{% if field == 'email' %}
<li>Please enter a valid email address.</li>
{% endif %}
{% endfor %}
</ul>
</p>
{% endif %}
<ul id="contact-form">
<li class="clearfix type-text">
<label for="name">Name</label>
<input type="text" id="name" name="contact[name]" />
</li>
<li class="clearfix type-text{% if form.errors contains 'email' %} has-error{% endif %}">
<label for="email">Email</label>
<input type="email" id="email" class="email" name="contact[email]" />
</li>
<li class="clearfix type-textarea{% if form.errors contains 'body' %} has-error{% endif %}">
<label for="message">Message</label>
<textarea id="message" name="contact[body]"></textarea>
</li>
<li class="clearfix type-submit">
<input type="submit" class="submit btn" value="Send" />
</li>
</ul>
{% endform %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment