Re: Custom form information not pulling through to email

Custom form information not pulling through to email

Mogulanddram
Visitor
3 0 0

Hi There,

I am very new to the world of coding and website. I want to have a page on my site where customers can request samples. I built the below and when submitting the form I only receive 'name, email and number' to my email address not the whole form. See below a screenshot of the form and code. Please help 😊 

Mogulanddram_0-1627492812218.png

 

 

<div class="page-width">
<div class="grid">
<div class="grid__item medium-up--five-sixths medium-up--push-one-twelfth">
<div class="section-header text-center">
<h1>{{ page.title }}</h1>
</div>

{% if page.content.size > 0 %}
<div class="rte">
{{ page.content }}
</div>
{% endif %}

<div class="contact-form form-vertical">
{%- assign formId = 'ContactForm' -%}
{% form 'contact', id: formId %}
{% include 'form-status', form: form, form_id: formId %}

<div class="grid grid--half-gutters">
<div class="grid__item medium-up--one-half">
<label for="{{ formId }}-name">{{ 'contact.form.name' | t }}</label>
<input type="text" id="{{ formId }}-name" name="contact[{{ 'contact.form.name' | t }}]" value="{% if form[name] %}{{ form[name] }}{% elsif customer %}{{ customer.name }}{% endif %}">
</div>
<div class="grid__item medium-up--one-half">
<label for="{{ formId }}-email">{{ 'contact.form.email' | t }} <span aria-hidden="true">*</span></label>
<input
type="email"
id="{{ formId }}-email"
name="contact[email]"
autocorrect="off"
autocapitalize="off"
value="{% if form.email %}{{ form.email }}{% elsif customer %}{{ customer.email }}{% endif %}"
aria-required="true"
{%- if form.errors contains 'email' -%}
class="input--error"
aria-invalid="true"
aria-describedby="{{ formId }}-email-error"
{%- endif -%}
>
{%- if form.errors contains 'email' -%}
<span id="{{ formId}}-email-error" class="input-error-message">
<span class="visually-hidden">{{ 'general.accessibility.error' | t }} </span>
{% include 'icon-error' %}
<span>{{ form.errors.translated_fields['email'] | capitalize }} {{ form.errors.messages['email'] }}.</span>
</span>
{%- endif -%}
</div>
</div>

<label for="{{ formId }}-phone">{{ 'contact.form.phone' | t }}</label>
<input type="tel" id="{{ formId }}-phone" name="contact[{{ 'contact.form.phone' | t }}]" pattern="[0-9\-]*" value="{% if form[phone] %}{{ form[phone] }}{% elsif customer %}{{ customer.phone }}{% endif %}">


<label> Company Name </label>
<input type="text"

<label> Street Address </label>
<input type="text"

<label> City/Town </label>
<input type="text"

<label> Postcode </label>
<input type="text"

</div>

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

{% endform %}
</div>
</div>
</div>
</div>

Reply 1 (1)

Clarke-
Shopify Partner
48 6 14

@Mogulanddram You need to add a name to the input elements and also close the tags.

 

<label> Street Address </label>
<input type="text"

 

 this would become

 

<label> Street Address </label>
<input type="text" name="contact[Street_Address]" />

 

 each input needs a name, so copy and repeat change the name between the square brackets contact[#NAME_HERE#]

 

as you can see in your own code you are recieving on name in email becaseu the input elements have the names eg. contact[email]

Please like and mark my post as a solution if I've helped you, thanks.