Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript and Cold Fusion form

Status
Not open for further replies.

yuchieh

MIS
Jul 21, 2000
178
US
We are using javascript, menu swapper - select some items in the left box, click the arrow button, the items go to the right box; or the same the other way for unselect) in a cold fusion page.
After we select tiems into the right box, the page goes to the action page with the "insert" query to insert the selected values into the database.
The problem is the value doesn't pass over to the action page. This is the error
"The specified form field cannot be found. This problem is very likely due to the fact that you have misspelled the form field name."

Please help!!!

Thanks.

------------------------------------------------------------
The following is the Java Script

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
function move(fbox, tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var i;
for (i = 0; i < tbox.options.length; i++) {
arrLookup[tbox.options.text] = tbox.options.value;
arrTbox = tbox.options.text;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < fbox.options.length; i++) {
arrLookup[fbox.options.text] = fbox.options.value;
if (fbox.options.selected && fbox.options.value != &quot;&quot;) {
arrTbox[tLength] = fbox.options.text;
tLength++;
}
else {
arrFbox[fLength] = fbox.options.text;
fLength++;
}
}
arrFbox.sort();
arrTbox.sort();
fbox.length = 0;
tbox.length = 0;
var c;
for(c = 0; c < arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
fbox[c] = no;
}
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
}
}
</script>

------------------------------------------------------------
The following (menu swapper) is in Cold Fusion form page.

The left box with all items listed --

<CFSELECT NAME=&quot;usused_states&quot; SIZE=&quot;3&quot; QUERY=&quot;unused_states&quot; VALUE=&quot;stateid&quot; DISPLAY=&quot;FullName&quot; multiple=&quot;Yes&quot;></CFSELECT>


The middle arrow buttons --

<input type=&quot;button&quot; onClick=&quot;move(this.form.usused_states,this.form.states)&quot; value=&quot; >> &quot;>
<input type=&quot;button&quot; onClick=&quot;move(this.form.states,this.form.usused_states)&quot; value=&quot; << &quot;>


The right box with no item selected originally --

<CFSELECT NAME=&quot;states&quot; SIZE=&quot;3&quot; VALUE=&quot;StateID&quot; DISPLAY=&quot;FullName&quot; MULTIPLE></CFSELECT>
 
make one of the var,s i into var j. Using the same var in two different procedures can confuse things.

Hope it helps,
Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top