I currently have a form that calls a query to dynamically create the form fields and value of checkboxes using coldfusion and javascript. What I have coded submits any boxes checkd by the user, but what I want to pull and pass to the next page are the selected checkboxes, plus the disabled fields. I tried adding checkbox.disabled to the logic, but either that won’t work or my syntax or logic was off. (well, I guess that was an obvious statement)
I figure I can go two ways, although have not been able to do either. Since the list of disabled fields is a list, I figured I could put it into an array and then append each element to the existing list, but it was not successful… then I thought I could somehow use the logic to also add the values of the disabled items, which also did not work. Could someone maybe point me in the right direction? I appreciate any help and your time!
Rough form code is (this is coldfusion but gives you an idea of where I am pulling my form data from, the question really is javascript mostly):
[code]
<cfloop query=”q_so1_list” startrow=”1″ endrow=”#q_so1_list.recordcount#”>
<cfif ListFind(tr_pick_so1, so1_cd)>
<input type=”checkbox” name=”pick_so1″ value=”#so1_cd#” checked disabled>
<cfelse>
<input type=”checkbox” name=”pick_so1″ value=”#so1_cd#”>
</cfif>
</cfloop>
<cfloop query=”q_so2_list” startrow=”1″ endrow=”#q_so2_list.recordcount#”>
<cfif ListFind(tr_pick_so2, so2_cd)>
<input type=”checkbox” name=”pick_so2″ value=”#so2_cd#” checked disabled>
<cfelse>
<input type=”checkbox” name=”pick_so2″ value=”#so2_cd#”>
</cfif>
</cfloop>
Rough submit code is:
[code]
for(var i = 0; i < pick_so1.length; i++){
if(document.form1.so1[i].checked)
so1_nm = so1_nm + String.fromCharCode(1) + String.fromCharCode(2) + pick_so1[i].value;
pick_so1.checked = true;
}
for(var i = 0; i < pick_so2.length; i++){
if(document.form1.so2[i].checked)
so2_nm = so2_nm + String.fromCharCode(1) + String.fromCharCode(2) + pick_so1[2].value;
pick_so2.checked = true;
}
so1_nm_list.value = so1_nm + String.fromCharCode(1) + String.fromCharCode(2);
so2_nm_list.value = so2_nm + String.fromCharCode(1) + String.fromCharCode(2);
return true;
Also, my quick array code was something like:
[code]
var a = new Array();
a = tr_pick_so1.split(/,/);
for(var k = 0; k < a.length; k++){
so1_nm_list.value = a[k] + String.fromCharCode(1) + String.fromCharCode(2);}
That caused undefined syntax errors…
Thanks again for any help!!!
Va.