Description:

This quick how-to will cover how to make a set amount of single checkboxes on an Eloqua 10 form required. Copy and paste the following code right before your ending tag on your landing page. To change the desired amount of required checkboxes simply change the “requiredChecked” variable to your desired number.

Details:

This code is set to “2” as an example. This example code would require that two checkboxes be selected before the form will submit. If at least two checkboxes are not selected, the user is made aware of the number of checkboxes that they must select via an alert box.

The Code:

<!– jQuery 1.12.4 –>
<script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js “></script>

<!– Script That Makes A Set Amount Of Checkboxes Required On An Eloqua 10 Form –>
<script type=”text/javascript”>
$(document).ready(function() {
$(‘input[type=submit]’).click(function() {
checked = $(“input[type=checkbox]:checked”).length;
<!– Change This To Your Desired Amount Of Required Checkboxes –>
requiredChecked = 2;
if (checked !== requiredChecked) {
alert(“You must check at least” + ” ” + requiredChecked + ” ” + “checkboxes.”);
return false;
}
});
});
</script>

Like My Work?

Let's Chat

Want to Work With Me?

Get My Resume

Let's Chat.