Contact form fields missing in notification email

Solved
Highlighted
New Member
4 0 0

Hi

Not all the fields on our contact form are appearing in the notification email we receive from customers. We only receive the below fields. Please can someone let me know why this is?

Many thanks,

Lottie

 

Name

Email

Phone number

Body (This is meant to say 'Other comments')

 

Here is the code:

{% section 'page-images' %}

<div class="wrapper page-margin">
<div class="grid">
<div class="grid__item large--two-thirds push--large--one-sixth">
<h1 class="text-center h2 templateTitle" style="display:none;">{{ page.title }}</h1>
<div class="rte">
{{ page.content }}
</div>

 


<div>
{% form 'contact' %}

{% comment %}
Successful message
{% endcomment %}
{% if form.posted_successfully? %}
<p class="note form-success">
{{ 'contact.form.post_success' | t }}
</p>
{% endif %}

{{ form.errors | default_errors }}

{% assign name_attr = 'contact.form.name' | t | handle %}
<label>Name</label>
<input type="text" id="ContactFormName" name="contact[{{ name_attr }}]" autocapitalize="words" value="{% if form[name_attr] %}{{ form[name_attr] }}{% elsif customer %}{{ customer.name }}{% endif %}">

<label>Email</label>
<label for="ContactFormEmail" class="label--hidden">{{ 'contact.form.email' | t }}</label>
<input type="email" id="ContactFormEmail" name="contact[email]" autocorrect="off" autocapitalize="off" value="{% if form.email %}{{ form.email }}{% elsif customer %}{{ customer.email }}{% endif %}">

<label>Phone Number</label>
{% assign name_attr = 'contact.form.phone' | t | handle %}
<label for="ContactFormPhone" class="label--hidden">{{ 'contact.form.phone' | t }}</label>
<input type="tel" id="ContactFormPhone" name="contact[{{ name_attr }}]" pattern="[0-9\-]*" value="{% if form[name_attr] %}{{ form[name_attr] }}{% elsif customer %}{{ customer.phone }}{% endif %}">


<label>Event/Occasion</label>
<textarea rows="1" id="ContactFormMessage" name="contact[body]" placeholder="e.g sons 1st birthday">{% if form.body %}{{ form.body }}{% endif %}</textarea>

<label>Number of guests to feed approx</label>
<textarea rows="1" id="ContactFormMessage" name="contact[body]">{% if form.body %}{{ form.body }}{% endif %}</textarea>

<label>Dietary requirements<p> We cater for gluten, dairy and nut free* (Please note: Our bakery handles dairy and nuts so there maybe a risk of a trace). Unfortunately we do not offer vegan cakes.</p></label>
<textarea rows="1" id="ContactFormMessage" name="contact[body]">{% if form.body %}{{ form.body }}{% endif %}</textarea>

<label>Style example<p> <h7> Please reference the code on the example images provided.</h7> </p></label>
<textarea rows="1" id="ContactFormMessage" name="contact[body]">{% if form.body %}{{ form.body }}{% endif %}</textarea>

<label>Theme/Ideas</label>
<textarea rows="1" id="ContactFormMessage" name="contact[body]">{% if form.body %}{{ form.body }}{% endif %}</textarea>

<label>What products are you after?</label>
<textarea rows="1" id="ContactFormMessage" name="contact[body]"placeholder="cake & cupcakes">{% if form.body %}{{ form.body }}{% endif %}</textarea>

<label>Other comments</label>
<textarea rows="10" id="ContactFormMessage" name="contact[body]">{% if form.body %}{{ form.body }}{% endif %}</textarea>

<input type="submit" class="btn right uppercase" value="{{ 'contact.form.send' | t }}">

{% endform %}
</div>

</div>

</div>

</div>

0 Likes
Highlighted
Excursionist
32 10 8

This is an accepted solution.

Hi Lottie,

 

Shopify pulls values from fields according to their name attribute. In your case, you have the same name attribute, contact[body], for a bunch of your fields, so it only pulls through the value from the last field.

 

To fix this, you want to do something like:

<label for="ContactFormEventOccasion">Event/Occasion</label>
<textarea rows="1" id="ContactFormEventOccasion" name="contact[event_occasion]" placeholder="e.g sons 1st birthday"></textarea>

<label for="ContactFormGuests">Number of guests to feed approx</label>
<textarea rows="1" id="ContactFormGuests" name="contact[guests]"></textarea>

<label for="ContactFormDietaryRequirements">Dietary requirements<p>We cater for gluten, dairy and nut free* (Please note: Our bakery handles dairy and nuts so there may be a risk of a trace). Unfortunately we do not offer vegan cakes.</p></label>
<textarea rows="1" id="ContactFormDietaryRequirements" name="contact[dietary_requirements]"></textarea>

<label for="ContactFormStyleExample">Style example<h6>Please reference the code on the example images provided.</h6></label>
<textarea rows="1" id="ContactFormStyleExample" name="contact[style_example]"></textarea>

<label for="ContactFormThemeIdeas">Theme/Ideas</label>
<textarea rows="1" id="ContactFormThemeIdeas" name="contact[theme_ideas]"></textarea>

<label for="ContactFormProducts">What products are you after?</label>
<textarea rows="1" id="ContactFormProducts" name="contact[products]" placeholder="cake & cupcakes"></textarea>

<label for="ContactFormOtherComments">Other comments</label>
<textarea rows="10" id="ContactFormOtherComments" name="contact[other_comments]"></textarea>

 

I hope this helps.

Was your problem solved? Please mark this post as an Accepted Solution
0 Likes
Highlighted
New Member
4 0 0

Thank you so much for this!

0 Likes