FROM CACHE - en_header

Checkboxes in contact form

Justin9
Shopify Partner
30 0 0
  <!-- Question checkbox -->
            <div class="question-box">
                <label class="label-title">Here comes the question...</label><br><br>
                <input type="checkbox" id="1" name="contact[Situatie]" value="1" /><span>Hairloss</span><br>
                <input type="checkbox" id="2" name="contact[Situatie]" value="2" /><span>Dandruff</span><br>
                <input type="checkbox" id="3" name="contact[Situatie]" value="3" /><span>Dry hair</span><br>
                <input type="checkbox" id="4" name="contact[Situatie]" value="4" /><span>Oily hair</span><br>
                <input type="checkbox" id="5" name="contact[Situatie]" value="5" /><span>Psoriasis</span><br>
                <input type="checkbox" id="6" name="contact[Situatie]" value="6" /><span>Itchy</span><br>
                <input type="checkbox" id="7" name="contact[Situatie]" value="7" /><span>Bald spots</span>
            </div>

Hello everyone,

I am making some kind of 'product advice' form for my customers. They have to fill in a couple of questions (radio boxes, checkboxes, open questions) so that I know what product would be the best for their concern.

One question gives them the possibility to check multiple boxes (checkboxes). However, when I get the email with answers, only the data of the last checked checkbox will come through.

How can I get the data of all checked checkboxes in the email and not only the last one?

Thank you very much,

Justin
 

E-Commerce Enthusiast
Replies 10 (10)
Justin9
Shopify Partner
30 0 0

I know I could change the name (name="contact[Situatie]") to make them all seperate but this doesn't look professional in the email.

I am aware of this solution and am wondering if there's another one.

E-Commerce Enthusiast
Lars_Ahlgren
New Member
1 0 0

I am interested in exactly the same solution. When I tried it the first time, I assumed the default behaviour from Shopify would be to list all of the selected checkboxes in one field on the email that's received, but that's not what happens.

 

webserviceXXL
Shopify Expert
5 0 1

I have the same problem and it seems the mail template of Shopify still does the same. As far as more then one checkbox ist checked the mail body online contains the last option. This solution is a standard HTML element. So I guess Shopify should respect form objects like this.

 

Any ideas?

Zach_Z
New Member
1 0 0

Hello Justin,

 

I'm having the same exact issue, I did try your solution by changing the name & placing (). Though when I tried that solution for myself, the question nor the checkbox answers didn't even show in the email. 

 

Any Thoughts?

 

Best Regards, 

Zach Z.  

crownthegoat
New Member
4 0 0

Hello, I have been trying to search how to align my checkbox section in the contact form. You can see the issue below in the photo. If anyone can assist me that would be much appreciated! 

contactform.JPG

Andrew-Werling
Excursionist
11 1 2

to have multiple options for the same name place brackets after the name

contact[Situatie][]

this will place the options they select in an array separated by new line characters

fernyherrera
New Member
1 0 0

It didn't work, normally that is the correct syntax though.

crownthegoat
New Member
4 0 0
Is this a visitor sending a message to my website? Where do I locate this?
Andrew-Werling
Excursionist
11 1 2

It's possible that you aren't able to store multiple email addresses for user accounts. 

If that is the case a work around would be to store the email addresses as a customer note

To store custom data as a customer note review the following example:

          <label for="CustomerFormCurrentSup">Current Supplements</label>
                    <input class="checkbox-form" type="checkbox" 
                        name="customer[note][Current Supplements][]" value="Probiotics" />
                    <p class="input-text">Probiotics</p><br />
                    <input class="checkbox-form" type="checkbox" 
                        name="customer[note][Current Supplements][]" value="Protein Powders" />
                    <p class="input-text">Protein Powders</p><br />
                    <input class="checkbox-form" type="checkbox" 
                        name="customer[note][Current Supplements][]" value="Vitamin A" />
                    <p class="input-text">Vitamin A</p><br />
                    <input class="checkbox-form" type="checkbox" 
                        name="customer[note][Current Supplements][]" value="Vitamin C" />
                    <p class="input-text">Vitamin C</p><br />
                    <input class="checkbox-form" type="checkbox" 
                        name="customer[note][Current Supplements][]" value="Vitamin D" />
                    <p class="input-text">Vitamin D</p><br />
                    <input class="checkbox-form" type="checkbox" 
                        name="customer[note][Current Supplements][]" value="Vitamin E" />
                    <p class="input-text">Vitamin E</p><br />
                    <input class="checkbox-form" type="checkbox" 
                        name="customer[note][Current Supplements][]" value="Vitamin K" />
                    <p class="input-text">Vitamin K</p><br />
                    <input class="checkbox-form" type="checkbox" 
                        name="customer[note][Current Supplements][]" value="Zinc" />
                    <p class="input-text">Zinc</p><br />

                    <input class="checkbox-form" type="checkbox" 
                        name="customer[note][Current Supplements][]" value="Other Supplement:" /><input
                        class="other-supplement" type="text" 
                        name="customer[note][Current Supplements][]" placeholder="Other..." autocorrect="off"
                        autocomplete="off" autocapitalize="off">
            </div>

 

 

Andrew-Werling
Excursionist
11 1 2

You can access these fields in the contact form liquid file. 

Probably named "something......contact-form.liquid" or containing a combination of those words depending on the theme you're using. 

There are additional ways to access similar fields in the registration liquid file used for creating members on your Shopify site.

This file will probably named "something......registration.liquid"