Solved

DAWN: how to make a form field required?

PLCollection
Tourist
18 0 2

How do I make the Name field required in the Contact Form?

 

Thanks

Accepted Solution (1)
AvadaCommerce
Shopify Partner
3879 839 951

This is an accepted solution.

Hi @PLCollection 

Please go to your Online Stores > Themes > Edit code > Sections > Open contact-form.liquid

Find the line that contains id="ContactForm-name" (around line 37). 
Replace this code 

 

 <input class="field__input" autocomplete="name" type="text" id="ContactForm-name" name="contact[{{ 'templates.contact.form.name' | t }}]" value="{% if form.name %}{{ form.name }}{% elsif customer %}{{ customer.name }}{% endif %}" placeholder="{{ 'templates.contact.form.name' | t }}">
          <label class="field__label" for="ContactForm-name">{{ 'templates.contact.form.name' | t }}</label>

 


With the following code: 

 

<input class="field__input" autocomplete="name" type="text" id="ContactForm-name" name="contact[{{ 'templates.contact.form.name' | t }}]" value="{% if form.name %}{{ form.name }}{% elsif customer %}{{ customer.name }}{% endif %}" placeholder="{{ 'templates.contact.form.name' | t }}" required> <label class="field__label" for="ContactForm-name">{{ 'templates.contact.form.name' | t }} <span aria-hidden="true">*</span></label>

 


If you feel like my answer is helpful, please mark it as a SOLUTION. Let me know if you have any questions!
banned

View solution in original post

Replies 5 (5)

kazi
Shopify Partner
543 85 105

@PLCollection  add required to the input field  you can find the contact form codes in sections > contact-form.liquid  

 

ex:   <input class="field__input" required autocomplete="name" type="text" id="ContactForm-name" name="contact[{{ 'templates.contact.form.name' | t }}]" value="{% if form.name %}{{ form.name }}{% elsif customer %}{{ customer.name }}{% endif %}" placeholder="{{ 'templates.contact.form.name' | t }}">

☑️ If the answer solve your issue please ✔ Accept it and hit like ✌️

► Need help with THEME CUSTOMIZATION, SPEED OPTIMIZATION ?


WhatsApp Email: Click here Skype: kof.bd
AvadaCommerce
Shopify Partner
3879 839 951

This is an accepted solution.

Hi @PLCollection 

Please go to your Online Stores > Themes > Edit code > Sections > Open contact-form.liquid

Find the line that contains id="ContactForm-name" (around line 37). 
Replace this code 

 

 <input class="field__input" autocomplete="name" type="text" id="ContactForm-name" name="contact[{{ 'templates.contact.form.name' | t }}]" value="{% if form.name %}{{ form.name }}{% elsif customer %}{{ customer.name }}{% endif %}" placeholder="{{ 'templates.contact.form.name' | t }}">
          <label class="field__label" for="ContactForm-name">{{ 'templates.contact.form.name' | t }}</label>

 


With the following code: 

 

<input class="field__input" autocomplete="name" type="text" id="ContactForm-name" name="contact[{{ 'templates.contact.form.name' | t }}]" value="{% if form.name %}{{ form.name }}{% elsif customer %}{{ customer.name }}{% endif %}" placeholder="{{ 'templates.contact.form.name' | t }}" required> <label class="field__label" for="ContactForm-name">{{ 'templates.contact.form.name' | t }} <span aria-hidden="true">*</span></label>

 


If you feel like my answer is helpful, please mark it as a SOLUTION. Let me know if you have any questions!
banned
PLCollection
Tourist
18 0 2

This works. Thank you!

AvadaCommerce
Shopify Partner
3879 839 951

You're welcome @PLCollection 

banned

Jahid-KlinKode
Excursionist
145 1 4

Hey @PLCollection, having issues with making contact page form fields required in Shopify's Dawn theme? Find the fix in this brief video guide: https://www.youtube.com/watch?v=0LI7iyHABpo