Would anyone be able to assist me with understanding how to edit the code (I think I need to add in Java) to allow a checklist within my contact form to submit multiple options, not just the last one that is selected.
I have successfully added in the checklists, but only the last selected option shows once the form is emailed through to me rather than the multiple options selected.
I also would love for the form to disappear upon submitting as I always have people submitting multiple times thinking that it hasn't gone through.
Thanks!
{% if type == 'block' %}
{% assign id = block.id %}
{% assign title = block.settings.title %}
{% assign contact_subheading = block.settings.contact_subheading %}
{% assign contact_content = block.settings.contact_content %}
{% assign contact_text_position = block.settings.contact_text_position %}
{% assign contact_text_alignment = block.settings.contact_text_alignment %}
{% else %}
{% assign id = section.id %}
{% assign title = section.settings.title %}
{% assign contact_subheading = section.settings.contact_subheading %}
{% assign contact_content = section.settings.contact_content %}
{% assign contact_text_position = section.settings.contact_text_position %}
{% assign contact_text_alignment = section.settings.contact_text_alignment %}
{% endif %}
<div class="container">
{% if title != blank %}
<h2 class="title center">{{ title }}</h2>
<div class="feature_divider"></div>
{% endif %}
<div class="contact_form contact_text_position--{{ contact_text_position }} contact_text_alignment--{{ contact_text_alignment }}">
<div class="{% if contact_text_position == 'center' %}
eight {% else %} seven {% endif %} columns contact_content">
{% if contact_subheading != blank %}
<h3>{{ contact_subheading }}</h3>
{% endif %}
{% if contact_content != blank %}
{{ contact_content }}
{% endif %}
</div>
<div class="eight columns">
{% form 'contact' %}
{% if form.posted_successfully? %}
<p class="quote">{{ 'contact.form.post_success' | t }}</p>
{% endif %}
{% if form.errors %}
<p class="quote">{{ 'general.forms.post_error' | t }}</p>
{% assign message = 'contact.form.message' | t %}
<ul class="center">
{% for field in form.errors %}
{% if field == 'form' %}
<li>
{{ form.errors.messages[field] }}
</li>
{% else %}
<li>
{% assign field_name = field | replace: 'body', message %}
{{ 'general.forms.post_field_error_html' | t: field: field_name, error: form.errors.messages[field] }}
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
<div class="four columns alpha">
{% assign name_attr = 'contact.form.name' | handle %}
<label for="contactFormName">{{ 'contact.form.name' | t }} <span class="red">*</span></label>
<input type="text" id="contactFormName" name="contact[{{ name_attr }}]" placeholder="First and Last Name" autocapitalize="words" value="{% if form[name_attr] %}{{ form[name_attr] }}{% elsif customer %}{{ customer.name }}{% endif %}" required="required">
</div>
<div class="four columns omega">
<label for="contactFormEmail">{{ 'contact.form.email' | t }} <span class="red">*</span></label>
<input type="email" id="contactFormEmail" name="contact[email]" placeholder="{{ 'contact.form.email' | t }}" autocorrect="off" autocapitalize="off" value="{% if form.email %}{{ form.email }}{% elsif customer %}{{ customer.email }}{% endif %}" required="required">
</div>
{% assign name_attr = 'contact.form.phone' | t | handle %}
<label for="contactFormPhone" class="hidden-label">{{ 'contact.form.phone' | t }} <span class="red">*</span></label>
<input type="tel" id="contactFormPhone" name="contact[{{ name_attr }}]" placeholder="{{ 'contact.form.phone' | t }}" pattern="[0-9\-]*" value="{% if form[name_attr] %}{{ form[name_attr] }}{% elsif customer %}{{ customer.phone }}{% endif %}">
<label for="ContactFormDate">Your event date <span class="red">*</span></label>
<input type="text" id="ContactFormDate" name="contact[Date]" placeholder="DD/MM/YYYY">
<label for="ContactFormLocation">Where are you located? <span class="red">*</span></label>
<input type="text" id="ContactFormLocation" name="contact[Location]" placeholder=" ">
<label for="ContactFormGuest">What is your guest count? <span class="red">*</span></label>
<input type="text" id="ContactFormGuest" name="contact[Guestno]" placeholder="The number of guests you're intending to host">
<label for="ContactFormInvite">What is your invitation count? <span class="red">*</span></label>
<input type="text" id="ContactFormInvite" name="contact[Inviteno]" placeholder="The number of invitations you're sending out (approx 60% of your guest count)">
<label for="ContactFormVenue">Your Venue</label>
<input type="text" id="ContactFormVenue" name="contact[Venue]" placeholder="Venue Name / Location">
<label>What are you enquiring about? <span class="red">*</span> </label>
<input type="radio" id="ContactFormEvent" name="contact[Eventtype]" value="Wedding or Event" /> Wedding or Event Stationery<br>
<input type="radio" id="contactFormEvent" name="contact[Eventtype]" value="Business Stationery" /> Business Stationery<br>
<input type="radio" id="contactFormEvent" name="contact[Eventtype]" value="Other" /> Other<br>
<br>
<label>Select what pieces you'd like a quote on: <span class="red">*</span></label>
<!-- Checkboxes -->
<input type="checkbox" id="ContactFormSavetheDate" class="invitepiece-checkbox" value="Save the Date" /> Save the Date<br>
<input type="checkbox" id="contactFormInvitation" class="invitepiece-checkbox" value="Invitation" /> Invitation<br>
<input type="checkbox" id="contactFormDetailsCard" class="invitepiece-checkbox" value="Details Card" /> Details Card<br>
<input type="checkbox" id="contactFormRSVP" class="invitepiece-checkbox" value="RSVP" /> RSVP<br>
<input type="checkbox" id="contactFormMap" class="invitepiece-checkbox" value="Map" /> Map<br>
<!-- Hidden input (must be filled for required validation to pass) -->
<input type="hidden" name="contact[Invitepieces]" id="InvitepiecesField" />
<span id="invitepieces-error" style="color: red; display: none;">Please select at least one piece.</span>
<br>
<label>Select what options you'd like to included: <span class="red">*</span> </label>
<input type="checkbox" id="ContactFormWax" name="contact[Options]" value="WaxSeals" /> Wax Seals<br>
<input type="checkbox" id="contactFormLiner" name="contact[Options]" value="Liners" /> Envelope Liners<br>
<input type="checkbox" id="contactFormHandmade" name="contact[Options]" value="Handmadepaper" /> Handmade Paper<br>
<input type="checkbox" id="contactFormIllustration" name="contact[Options]" value="Illustration" /> Custom Illustration<br>
<input type="checkbox" id="contactFormCalligraphy" name="contact[Options]" value="Calligraphy" /> Calligraphy<br>
<br>
<label>Event Day Pieces: <span class="red">*</span> </label>
<input type="checkbox" id="ContactFormMenu" name="contact[Dayof]" value="Menus" /> Menus<br>
<input type="checkbox" id="contactFormPlacecard" name="contact[Dayof]" value="Placecards" /> Place Cards<br>
<input type="checkbox" id="contactFormSeating" name="contact[Dayof]" value="Seating" /> Seating Chart<br>
<input type="checkbox" id="contactFormWelcome" name="contact[Dayof]" value="Welcome" /> Welcome Sign<br>
<input type="checkbox" id="contactFormOther" name="contact[Dayof]" value="Other" /> Other<br>
<br>
<label for="ContactFormBudget">What is your budget?<span class="red">*</span></label>
<select id="ContactFormBudget" name="contact[budget]" required>
<option value="">Please select</option>
<option value="1500">$1500 - $2000</option>
<option value="2000">$2000 - $3000</option>
<option value="3000">$3000 - $4000</option>
<option value="4000">$4000+</option>
</select>
<br>
<label for="contactFormMessage">Please describe your vision for your wedding day, including the aesthetic, mood, and overall ambiance you envision. We would love to understand your unique style and preferences to create wedding stationery that perfectly captures the essence of your special day. Feel free to share any specific details, themes, or inspirations that you have in mind. <span class="red">*</span></label>
<textarea rows="5" id="contactFormMessage" name="contact[body]" placeholder=" " required="required">{% if form.body %}{{ form.body }}{% endif %}</textarea>
{{ section.settings.contact_form_text }}
<br>
<label for="ContactFormPinterest">If you have a Pinterest Board please link it here:</label>
<input type="text" id="ContactFormPinterest" name="contact[Pinterest]" placeholder="https://www.pinterest.com/">
<br>
<label for="ContactFormExtra">Do you have any extra comments or questions?:</label>
<input type="text" id="ContactFormExtra" name="contact[Extra]" placeholder=" ">
<br>
<label for="ContactFormReferral">How did you hear about us?</label>
<select id="ContactFormReferral" name="contact[referral]">
<option value="">Please select</option>
<option value="familyfriend">Family / Friend</option>
<option value="Instagram">Instagram</option>
<option value="google">Google Search</option>
<option value="directory">Wedding Website / Magazine</option>
<option value="other">Other</option>
</select>
<br>
<input type="submit" class="submit action_button" value="{{ 'contact.form.send' | t }}" />
{% endform %}
</div>
</div>
</div>
multipleattribute for form elements, as well as taking a look at this checkbox group answer though I do think the questions are sufficiently different that it's worth not flagging as duplicatecontact[Options_1],contact[Options_2]etc. to achieve the desired result.