How to set a required field in Dawn's contact form?

Solved

How to set a required field in Dawn's contact form?

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 984

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
633 91 114

@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 you need more help with your Shopify store
Speed Optimization | Theme Customization ? ☎️ WhatsApp ✉️Email Skype: kof.bd

AvadaCommerce
Shopify Partner
3879 839 984

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 984

You're welcome @PLCollection 

banned

Jahid-KlinKode
Excursionist
145 1 5

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