>>I agree, but I still have to enter all the form field names in the
<cfparam>
anyways so I'm not really gaining anything.
I have solved this problem once for all this way :
1. in your form page, add this JS function call onsubmit, ie:
var defaultList = "";
function checkInput(formul)
{
if(!formul) formul = "formul";
curRadio = "";
form = document[formul];
if (form == null) return;
for (var i = 0; i < form.elements.length; i++)
{
// create default list
if (field.type && !field.disabled)
{
switch (field.type)
{
case 'radio':
case 'checkbox':
{
if (defaultList.lastIndexOf(field.name) < 0) defaultList +=
"," + field.name;
break;
}
case 'select-one':
case 'select-multiple':
{
if (defaultList.lastIndexOf(field.name) < 0) defaultList +=
"," + field.name;
break;
}
} //switch
} // if
} // for
var inp = form.defaultList;
if (!inp)
{
inp = document.createElement("INPUT");
inp.type = "hidden";
inp.name = "defaultList";
form.appendChild (inp);
}
inp.value = defaultList.substr(1);
return;
}
This will add or update a hidden field in your form with the list of all
fields in your form, empty or not.
2. in your action page, add this CF function:
<CFIF isDefined ("form.defaultList")>
<CFLOOP INDEX="checkBox" LIST="#form.defaultList#">
<CFPARAM NAME="form.#checkBox#" DEFAULT="0">
</CFLOOP>
</CFIF>
You can set the default value you want.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314554
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4