Trying to add a field to a form but I'm lacking basic undertanding of forms

mance-dev
New Member
1 0 1

Hey all,

I'm a new web developer but I was asked by a family friend to help build this Shopify website. Liquid is fairly different than the typical HTML and CSS I work with and so I'd like some guidance here if possible.

I'm creating a page and basically adding the default contact form to the page - but I need to add one extra field for text (the field is for a product code).

The field shows up on the front-end but with the label being: "translation missing: en.contact.form.code". I copied the code from the "contact.form.name" field and changed the instances of "name" to "code". What am I missing? When someone submits this form, wil the code also be submitted in the email to the store owner?

Here's the code I copied:
```<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>```

 

and this is the code I am editing

``` <div class="grid__item medium-up--one-half">
<label for="{{ formId }}-code">{{ 'contact.form.code' | t }}</label>
<input type="text" id="{{ formId }}-code" name="contact[{{ 'contact.form.code' | t }}]" value="{% if form[code] %}{{ form[code] }}{% elsif customer %}{{ customer.code }}{% endif %}">
</div>```

KetanKumar
Shopify Partner
14245 1657 5128

@mance-dev 

thanks for it 

https://shopify.dev/tutorials/customize-theme-add-fields-to-your-contact-form

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Expert | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
0 Likes