Checkboxes on form not sending all selected

Home Forums Porto – Responsive HTML5 Template Checkboxes on form not sending all selected

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #10045971
    acairns
    Participant

    Hi,

    I’m using php -> contact-form-recaptcha-v3.php to send my form.

    The form has checkboxes and the form works – sends the submitted info – except the email received only lists the last selected item of the checkbox set.

    One of my checkboxes is for the days of the week. https://princensammyfoundation.com/become-a-volunteer. The form lists the dates and checkboxes as

    <div class="form-check form-check-inline">
      <label class="form-check-label">
         <input class="form-check-input" name="days[]" type="checkbox" data-msg-required="Please select at least one option." id="days_Mon" value="Monday"> Monday
      </label>										</div>
    										<div class="form-check form-check-inline">
       <label class="form-check-label">
          <input class="form-check-input" name="days[]" type="checkbox" data-msg-required="Please select at least one option." id="days_Tue" value="Tuesday"> Tuesday
       </label>
    </div>

    etc, for Monday through Sunday checkboxes.

    And contact-form-recaptcha-v3.php includes the lines from 77 – 80 which seems to be for the checkbox array

    // Checkboxes
     if( is_array($value) ) {
         // Store new value
         $value = implode(', ', $value);
    }

    But when I fill out the form, if I select Wednesday and Friday, only Friday displays in the email when it is received.

    Am I missing something?

    Thank you,
    Alison


    • This topic was modified 1 month, 3 weeks ago by Support.

    Template Version: contact-form-recaptcha-v3 file states Theme Version: 12.1.0
    #10045974
    Support
    Keymaster

    Hi, try to change this part of the code:

    js/views/view.contact.js (line 190):

    Add this:

    $(formData).each(function(index, obj){
    	if( data[obj.name] ) {
    		data[obj.name] = data[obj.name] + ', ' + obj.value;						
    	} else {
    		data[obj.name] = obj.value;
    	}
    });

    • This reply was modified 1 month, 3 weeks ago by Support.
    #10045978
    acairns
    Participant

    Perfect. Works like a charm.

    Thanks very much.

    Alison


Viewing 3 posts - 1 through 3 (of 3 total)

This topic is marked as "RESOLVED" and can not rceive new replies.