This function pretend to read from a csv and populate a table of input field . Having rows and columns I need to nest loops or call function in a loop, or even call function by itself . I tried already all the combinations . In the best case it populates only the first row ( A1,B1,C1, etc.. ) , it knows exactly the starting point in buffer and everything apparently is correct in the numbers it makes , BUT the outer loop is broken after the first iteration (whatever I do with my code about inner function, or inner loop, or nested function ) . I tried "continue", "return", the closure stuff.
function getPage(p) {
var init = buffer.indexOf("Page:" + p + ",");
var init_index = init + 1;
var linea = "";
var r = 1;
for (var x in buffer) {
if (x > init_index) {
linea = buffer[x].split(",");
read_line(linea, r);
r++;
}
}
}
function read_line(l, r) {
var debug = new Array();
var n = 0;
while (n < l.length + 1) {
var colons = ["A" + r, "B" + r, "C" + r, "D" + r, "E" + r, "F" + r, "G" + r, "H" + r, "se_ckbox" + r, "me_ckbox" + r, "sim_ckbox" + r, "I" + r, "J" + r, "K" + r, "L" + r, "M" + r, "N" + r, "O" + r, "P" + r, "Q" + r, "R" + r, "S" + r, "T" + r, "U" + r, "V" + r];
var field = l[n + 1];
debug.push("col:" + colons[n].toString() + "\nVAL:" + field + "\n");
document.getElementById(colons[n].toString()).value = field;
document.getElementById("debug").value = debug.toString();
n++;
}
return;
}