Hi, all!
Here's another one that's starting to boggle my mind.
I have a form that, with a button, adds a bunch of text-fields in a tablerow.
For every press of the button another row is added. This works in both IE and FF. No probs.
When pressing another button, Register, the information in the form is to be stored in a db.
In the javascript funktion assigned to this button I have a loop that goes through the dynamically created rows of text-fields, and stores the values in variables.
These vars is then passed to an ajax-function.
I have tried with calling the function once in every iteration of the loop. But if you have a bunch or rows, 9 or more, only a few rows of information is stored, 3 or less. Like this:
for (i = 0; i < nrapps; i++) {
var appnr = document.Form1.elements['txtAppNr' + id].value;
var floor = document.Form1.elements['txtFloor' + id].value;
var unitplac = document.Form1.elements['txtUnitPlac' + id].value;
var consid = document.Form1.elements['txtConsID' + id].value;
var unitnr = document.Form1.elements['txtUnitNr' + id].value;
var unitset = document.Form1.elements['txtUnitSet' + id].value;
var fuse = document.Form1.elements['txtFuse' + id].value;
var customer = document.Form1.elements['txtCustomer' + id].value;
var dob = document.Form1.elements['txtDOB' + id].value;
<ajaxcode>.CB_Function(regid,appnr,floor,unitplac,consid,unitnr,unitset,fuse,customer,dob,ServerSide_Callback2);
if (On_Error == true) { return; }
id++;
}
So my thought was to store the information in a 2D-array and then pass that array to the ajax-function in order to let that function in turn store the information to the db in it's own loop.
for (i = 0; i < arrSize ; i++) {
arrApps[i][0] = document.Form1.elements['txtAppNr' + id].value;
arrApps[i][1] = document.Form1.elements['txtFloor' + id].value;
arrApps[i][2] = document.Form1.elements['txtUnitPlac' + id].value;
arrApps[i][3] = document.Form1.elements['txtConsID' + id].value;
arrApps[i][4] = document.Form1.elements['txtUnitNr' + id].value;
arrApps[i][5] = document.Form1.elements['txtUnitSet' + id].value;
arrApps[i][6] = document.Form1.elements['txtFuse' + id].value;
arrApps[i][7] = document.Form1.elements['txtCustomer' + id].value;
arrApps[i][8] = document.Form1.elements['txtDOB' + id].value;
if (On_Error == true) { return; }
id++;
}
<ajaxcode>.CB_Function(arrApps,nrapps,ServerSide_Callback2);
I've read that you can pass an array in the form of an object. But how do I turn this 2D-array into an object that can be passed? (I'm using AjaxPro by Michael Schwarz)