Coldfusion: How to submit a form if all the check boxes are unchecked?

I have a form with a few checkboxes. When submitting without checking at least one checkbox a error happens.   How to submit a form if all the check boxes are unchecked? Thanks.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

gdemariaConnect With a Mentor Commented:
Use cfparam to give it a default value
At the top of your action page, put this for each checkbox:

<cfparam name="form.xxxx" default="">

where xxxx is the name of your input tag for your checkbox.  
This is needed because a checkbox does not send a form variable when it is not checked.   This creates the variable if it does not exist.  If the variable exists, this does nothing
Gurpreet Singh RandhawaWeb DeveloperCommented:
well what @gde has is correct, another way is you can just use the following in your checkboxes to make it work,

<cfsetting showdebugoutput="false">
<form id="form' name="form">
<input type="checkbox" id="Checkbox1" value = "1" />
<input type="checkbox" id="Checkbox2" value = "2" />
<input type="checkbox" id="Checkbox3" value = "3" />
<input type="checkbox" id="Checkbox4" value = "4" />
<input type="button" id="demo" value = "Demo" />

<script type = "text/javascript" src = ""></script>
<script type="text/javascript">
    $(document).ready(function() {
		$(document).on("click", "#demo", function () {
			$("input:checkbox:not(:checked)").each(function () {
				$('<input>').attr({type: 'text',id: $(this).attr("id"),name: $(this).attr("id"),value: $(this).val()}).appendTo('form');
				//alert("Id: " + $(this).attr("id") + " Value: " + $(this).val());

Open in new window

for this $('<input>').attr({type: 'text', you can make it use $('<input>').attr({type: 'hidden',
Best practice to simply provide a value if none is passed.
All Courses

From novice to tech pro — start learning today.