Mandatory Group Interests not working
-
Hi there I’ve just added interest groups to my signup form – the following code is as per the example given in your help docs to make the selection of at least one interest group checkbox mandatory but it’s not working. The subscription completes without any warning /prompt to select an interest group…
Code as per this: https://kb.mc4wp.com/interest-groupings-required-field/
Is there anything wrong with this code below? Web address of the page can be provided privately. Plugin version is Version 4.1.4
<p>
<input type=”text” name=”FNAME” placeholder=”Your first name”>
</p>
<p>
<input type=”text” name=”LNAME” placeholder=”Your last name”>
</p>
<p>
<input type=”email” name=”EMAIL” placeholder=”Your email address” required=”required”>
</p>
<p>
<label>Please tell me if you are a Yoga Teacher or a Yoga Student…</label>
<label><input name=”INTERESTS[da08d4c94b][]” type=”checkbox” value=”1b4a15f029″ checked> <span>Yoga Teachers</span>
</label>
<label><input name=”INTERESTS[da08d4c94b][]” type=”checkbox” value=”a65682237f”> <span>Yoga Students</span>
</label>
</p>
<p>
<input type=”text” name=”MMERGE3″ placeholder=”How did you hear about me?”>
</p>
<p>
<input type=”text” name=”MMERGE4″ placeholder=”Your mobile number”>
</p>
<p>To help us distinguish between forms submitted by individuals and those automatically generated by spam software, please enter the question below.{captcha}</p>
<p>
<input type=”submit” value=”Sign up” />
</p><script>
jQuery(‘.mc4wp-form’).find(‘form’).on(‘submit’, function(evt) {
var checkboxFields = jQuery(this).find(‘[name^=”INTERESTS”]’);if( checkboxFields.length ) {
// check if at least one field is required
for(var i=0; i<checkboxFields.length; i++) {
if( checkboxFields[i].checked ) {
return true;
}
}alert(“Please select at least 1 group.”);
evt.preventDefault;
return false;
}return true;
});
</script>Many thanks in advance.
- The topic ‘Mandatory Group Interests not working’ is closed to new replies.