FROM CACHE - en_header

DAWN: how to make a form field required?

Solved
PLCollection
Tourist
18 0 2

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

 

Thanks

Accepted Solution (1)

Accepted Solutions
AvadaCommerce
Shopify Partner
3879 837 797

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!

AVADA - Top Rated App for Email, SMS, Popups


Check our website for full features and start a FREE TRIAL.
Install another app to boost sales, 100% FREE

View solution in original post

Replies 4 (4)
kazi
Shopify Partner
381 68 79

@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, fix bugs?


► Email: Click here Skype: kof.bd
AvadaCommerce
Shopify Partner
3879 837 797

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!

AVADA - Top Rated App for Email, SMS, Popups


Check our website for full features and start a FREE TRIAL.
Install another app to boost sales, 100% FREE

PLCollection
Tourist
18 0 2

This works. Thank you!

AvadaCommerce
Shopify Partner
3879 837 797

You're welcome @PLCollection 

AVADA - Top Rated App for Email, SMS, Popups


Check our website for full features and start a FREE TRIAL.
Install another app to boost sales, 100% FREE