blob: 53ba2b54255ef982529191a85193111583e6fc7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Global Variables
var rowname = new Array(99);
var rowtype = new Array(99);
var newrow = new Array(99);
for (i = 0; i < 99; i++) {
rowname[i] = '';
rowtype[i] = '';
newrow[i] = '';
}
var field_counter_js = 0;
var loaded = 0;
var is_streaming_progress_bar = 0;
var temp_streaming_text = "";
var addRowTo = (function() {
return (function (tableId) {
var d, tbody, tr, td, bgc, i, ii, j;
d = document;
tbody = d.getElementById(tableId).getElementsByTagName("tbody").item(0);
tr = d.createElement("tr");
totalrows++;
for (i = 0; i < field_counter_js; i++) {
td = d.createElement("td");
if(rowtype[i] == 'textbox') {
td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input name='" + rowname[i] + totalrows + "'></input> ";
} else if(rowtype[i] == 'select') {
td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><select name='" + rowname[i] + totalrows + "'>" + newrow[i] + "</select> ";
} else if(rowtype[i] == 'checkbox') {
td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input type='checkbox' name='" + rowname[i] + totalrows + "'></input> ";
} else if(rowtype[i] == 'input') {
td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input size='8' name='" + rowname[i] + totalrows + "'></input> ";
} else if(rowtype[i] == 'password') {
td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input type='password' name='" + rowname[i] + totalrows + "'></input> ";
}
tr.appendChild(td);
}
td = d.createElement("td");
td.rowSpan = "1";
td.innerHTML = '<input type="image" src="/x.gif" onclick="removeRow(this); return false;" value="Delete">';
tr.appendChild(td);
tbody.appendChild(tr);
});
})();
function removeRow(el) {
var cel;
while (el && el.nodeName.toLowerCase() != "tr")
el = el.parentNode;
if (el && el.parentNode) {
cel = el.getElementsByTagName("td").item(0);
el.parentNode.removeChild(el);
}
}
function find_unique_field_name(field_name) {
// loop through field_name and strip off -NUMBER
var last_found_dash = 0;
for (var i = 0; i < field_name.length; i++) {
// is this a dash, if so, update
// last_found_dash
if (field_name.substr(i,1) == "-" )
last_found_dash = i;
}
if (last_found_dash < 1)
return field_name;
return(field_name.substr(0,last_found_dash));
}
|