title: Volunteer Form Maximum call stack size exceeded
body: <p>My form was working just fine at one point and then I added some extra form data fields and boom started getting this.<br><br> <a href="https://gist.github.com/DrSarge/f5110bf79520e547b0f2f10ff3f40392" rel="nofollow noreferrer">Here</a> is a link to the JS it is complaining about.</p>
  
  <p>Here is what the console brings me to when I click on the error:</p>
  
  <pre><code>function Vc(a, b, c, d) {
          var e;
          if (m.isArray(b))
              m.each(b, function(b, e) {
                  c || Rc.test(a) ? d(a, e) : Vc(a + "[" + ("object" == typeof e ? b : "") + "]", e, c, d)
              });
          else if (c || "object" !== m.type(b))
              d(a, b);
          else
              for (e in b)
                  Vc(a + "[" + e + "]", b[e], c, d)
      }
  </code></pre>
  
  <p>Along with this</p>
  
  <pre><code>type: function(a) {
              return null == a ? a + "" : "object" == typeof a || "function" == typeof a ? h[i.call(a)] || "object" : typeof a
          }
  </code></pre>
  
  <p><br><br> <a href="https://gist.github.com/DrSarge/043d5096ec747bfadaa58839ad4c7c90" rel="nofollow noreferrer">Here</a> is a link to the HTML code for the form. </p>
  
  <p><kbd>Form JS</kbd></p>
  
  <pre><code>$(function() {
  
      $("#contact_form input,#contact_form textarea").jqBootstrapValidation({
          preventSubmit: true,
          submitError: function($form, event, errors) {
              // something to have when submit produces an error ?
              // Not decided if I need it yet
          },
          submitSuccess: function($form, event) {
              event.preventDefault(); // prevent default submit behaviour
              // get values from FORM
              var name = $("input#name").val();
              var lastName = $("input#lastName").val();
              var gender = $("select#gender").val();
              var phone = $("input#phone").val();
              var email = $("input#email").val();
              var address = $("input#address").val();
              var city = $("input#city").val();
              var state = $("select#state").val();
              var country = $("select#country").val();
              var zip = $("input#zip").val();
              var title = $("select#title").val();
              var otherTitle = $("input#otherTitle").val();
              var specialty = $("select#specialty").val();
              var otherSpecialty = $("input#otherSpecialty").val();
              var skill = $("select#skill").val();
              var otherSkill = $("input#otherSkill").val();
              var africa = document.getElementById("africa").checked;
  //            var africa = $("input#africa").checked;
              var caribbean = document.getElementById("caribbean").checked;
  //            var caribbean = $("input#caribbean").checked;
              var eSeAsia = document.getElementById("eseAsia").checked;
  //            var eSeAsia = $("input#eseAsia").val();
              var europe = document.getElementById("europe").checked;
  //            var europe = $("input#europe").val();
              var india = document.getElementById("india").checked;
  //            var india = $("input#india").val();
              var latinAmerica = document.getElementById("latinAmerica").checked;
  //            var latinAmerica = $("input#latinAmerica").val();
  //            var arabic = $("input#arabic").val();
              var arabic = document.getElementById("arabic").checked;
              var arabicLevel = $("select#arabicLevel").val();
  //            var chinese = $("input#chinese").val();
              var chinese = document.getElementById("chinese").checked;
              var chineseLevel = $("select#chineseLevel").val();
  //            var english = $("input#english").val();
              var english = document.getElementById("english").checked;
              var englishLevel = $("select#englishLevel").val();
  //            var french = $("input#french").val();
              var french = document.getElementById("french").checked;
              var frenchLevel = $("select#frenchLevel").val();
  //            var german = $("input#german").val();
              var german = document.getElementById("german").checked;
              var germanLevel = $("select#germanLevel").val();
  //            var hindi = $("input#hindi").val();
              var hindi = document.getElementById("hindi").checked;
              var hindiLevel = $("select#hindiLevel").val();
  //            var korean = $("input#korean").val();
              var korean = document.getElementById("korean").checked;
              var koreanLevel = $("select#koreanLevel").val();
  //            var lao = $("input#lao").val();
              var lao = document.getElementById("lao").checked;
              var laoLevel = $("select#laoLevel").val();
  //            var portuguese = $("input#portuguese").val();
              var portuguese = document.getElementById("portuguese").checked;
              var portugueseLevel = $("select#portugueseLevel").val();
  //            var spanish = $("input#spanish").val();
              var spanish = document.getElementById("spanish").checked;
              var spanishLevel = $("select#spanishLevel").val();
  //            var vietnamese = $("input#vietnamese").val();
              var vietnamese = document.getElementById("vietnamese").checked;
              var vietnameseLevel = $("select#vietnameseLevel").val();
  //            var other = $("input#other").val();
              var other = document.getElementById("other").checked;
              var otherLevel = $("select#otherLevel").val();
              var otherInput = $("input#otherInput").val();
              var volunteerYes = document.getElementById("volunteerYes").checked;
              var organizationCountry = $("input#volunteerCountry").val();
              var volunteerNo = document.getElementById("volunteerNo").checked;
              var message = $("textarea#message").val();
  
              var firstName = name; // For Success/Failure Message
              // Check for white space in name for Success/Fail message
              if (firstName.indexOf(' ') &gt;= 0) {
                  firstName = name.split(' ').slice(0, -1).join(' ');
              }
              $.ajax({
                  url: "./bin/volunteer.php",
                  type: "POST",
                  data: {
                      name: name,
                      lastName: lastName,
                      gender: gender,
                      phone: phone,
                      email: email,
                      address: address,
                      city: city,
                      state: state,
                      country: country,
                      zipcode: zip,
                      Title: title,
                      otherTitle: otherTitle,
                      specialty: specialty,
                      otherSpecialty: otherSpecialty,
                      skill: skill,
                      otherSkill: otherSkill,
                      africa: africa,
                      caribbean: caribbean,
                      eSeAsia: eSeAsia,
                      europe: europe,
                      india: india,
                      latinAmerica: latinAmerica,
                      arabic: arabic,
                      arabiclevel: arabicLevel,
                      chinese: chinese,
                      chineselevel: chineseLevel,
                      english: english,
                      englishlevel: englishLevel,
                      french: french,
                      frenchlevel: frenchLevel,
                      german: german,
                      germanlevel: germanLevel,
                      hindi: hindi,
                      hindilevel: hindiLevel,
                      korean: korean,
                      koreanlevel: koreanLevel,
                      lao: lao,
                      laolevel: laoLevel,
                      portuguese: portuguese,
                      portugueselevel: portugueseLevel,
                      spanish: spanish,
                      spanishlevel: spanishLevel,
                      vietnamese: vietnamese,
                      vietnameselevel: vietnameseLevel,
                      other: other,
                      otherlevel: otherLevel,
                      otherlanguage: otherInput,
                      volunteerYes: volunteerYes,
                      volunteerCountry: volunteerCountry,
                      volunteerNo: volunteerNo,
                      message: message
                  },
                  cache: false,
                  success: function() {
                      // Success message
                      $('#success').html("&lt;div class='alert alert-success'&gt;");
                      $('#success &gt; .alert-success').html("&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;&amp;times;")
                          .append("&lt;/button&gt;");
                      $('#success &gt; .alert-success')
                          .append("&lt;strong&gt;Your message has been sent. &lt;/strong&gt;");
                      $('#success &gt; .alert-success')
                          .append('&lt;/div&gt;');
  
                      //clear all fields
                      $('#contact_form').trigger("reset");
                  },
                  error: function() {
                      // Fail message
                      $('#success').html("&lt;div class='alert alert-danger'&gt;");
                      $('#success &gt; .alert-danger').html("&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;&amp;times;")
                          .append("&lt;/button&gt;");
                      $('#success &gt; .alert-danger').append("&lt;strong&gt;Sorry " + firstName + " it seems that my mail server is not responding...&lt;/strong&gt; Could you please email me directly to &lt;a href='mailto:me@example.com?Subject=Message_Me from myprogrammingblog.com;&gt;me@example.com&lt;/a&gt; ? Sorry for the inconvenience!");
                      $('#success &gt; .alert-danger').append('&lt;/div&gt;');
                      //clear all fields
                      $('#contact_form').trigger("reset");
                  },
              })
          },
          filter: function() {
              return $(this).is(":visible");
          },
      });
  
      $("a[data-toggle=\"tab\"]").click(function(e) {
          e.preventDefault();
          $(this).tab("show");
      });
  });
  
  
  /*When clicking on Full hide fail/success boxes */
  $('#name').focus(function() {
      $('#success').html('');
  });
  </code></pre>
  
  <p>the <kbd>php-form</kbd> looks like this here:</p>
  
  <pre><code>&lt;?php
  // Check for empty fields
  if(empty($_POST['name'])      ||
     empty($_POST['lastName'])      ||
     empty($_POST['gender'])      ||
     empty($_POST['email'])     ||
     empty($_POST['phone'])     ||
     empty($_POST['address'])     ||
     empty($_POST['city'])     ||
     empty($_POST['state'])     ||
     empty($_POST['country'])     ||
     empty($_POST['zipcode'])     ||
     empty($_POST['message'])   ||
     !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
     {
     echo "No arguments Provided!";
     return false;
     }
  
  
  
  // Create the email and send the message
  $to = 'youngmarines37@gmail.com'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
  
  $email_subject = "Website Volunteer Form:  $name";
      $email_body = "You have received a new message from
      your website volunteer form.\n\n".
      "Here are the details:\n";
  
  
      foreach($_POST as $key =&gt; $value) {
          $value = strip_tags(htmlspecialchars($value));
          if($value!="" &amp;&amp; $value!="false") {
              $email_body .= "$key : $value \n";
          }
      }
  
  
  /*
  $email_subject = "Website Volunteer Form:  $name";
  $email_body = "You have received a new message from
  your website volunteer form.\n\n".
  "Here are the details:\nFirst Name: $name\nLast Name: $lastName\nGender: $gender\n\nEmail: $email_address\nPhone: $phone\n\n
  Address: $address\nCity: $city\nState: $state\nCountry: $country\nZip: $zipcode\n\n
  Medical Degree/Title: $Title\nSpecality: $specialty\nNon-Medical Skill: $skill\n\n
  Interested in Africa: $africa\nInterested in Caribbean: $caribbean\nInterested in E. or S.E. Asia: $eSeAsia\nInterested in Europe: $europe\nInterested in India: $india\nInterested in Latin America: $latinAmerica\n\n
  Message:\n$message";
  */
  $headers = "From: noreplyw4wh@gmail.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
  $headers .= "Reply-To: $email_address";
  mail($to,$email_subject,$email_body,$headers);
  return true;
  ?&gt;
  </code></pre>