Permalink
Browse files

Added interface_selection for use in tinydns

Corrected the use of objectsize so that if its "undefined" the correct "rowsize[]" is used
which if used outside the for loop was also "undefined"
  • Loading branch information...
1 parent 74fa57a commit de69fab34c3aa4bfab61e47cfefac45fd1583f04 @Whizkidzz Whizkidzz committed Apr 6, 2012
Showing with 8 additions and 5 deletions.
  1. +8 −5 usr/local/www/javascript/row_helper_dynamic.js
@@ -25,17 +25,18 @@ var temp_streaming_text = "";
var addRowTo = (function() {
return (function (tableId, objectSize) {
var $ = jQuery;
- var d, tbody, tr, td, bgc, i, ii, j, className;
+ var d, tbody, tr, td, bgc, i, ii, j, size, className;
d = document;
tbody = d.getElementById(tableId).getElementsByTagName("tbody").item(0);
tr = d.createElement("tr");
totalrows++;
- if (!objectSize)
- objectSize = rowsize[i];
+ size = objectSize;
for (i = 0; i < field_counter_js; i++) {
+ if (!objectSize)
+ size = rowsize[i];
td = d.createElement("td");
if(typeof(rowtype[i]) == 'function') {
- td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input>" + rowtype[i](rowname[i], objectSize, totalrows) + " ";
+ td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input>" + rowtype[i](rowname[i], size, totalrows) + " ";
} else if(rowtype[i] == 'textbox') {
td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input " + rowhelper_onChange + " size='" + rowsize[i] + "' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'></input> ";
} else if(rowtype[i] == 'textbox,ipv4v6') {
@@ -44,12 +45,14 @@ var addRowTo = (function() {
td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><select " + rowhelper_onChange + " name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'>" + newrow[i] + "</select> ";
} else if(rowtype[i] == 'select,ipv4v6') {
td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><select " + rowhelper_onChange + " name='" + rowname[i] + totalrows + "' class='ipv4v6' id='" + rowname[i] + totalrows + "'>" + newrow[i] + "</select> ";
+ } else if(rowtype[i] == 'interfaces_selection') {
+ td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><select " + rowhelper_onChange + " name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'>" + newrow[i] + "</select> ";
} else if(rowtype[i] == 'select_source') {
td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><select " + rowhelper_onChange + " name='" + rowname[i] + totalrows + "' id='" + 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 " + rowhelper_onChange + " type='checkbox'name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'></input> ";
} else if(rowtype[i] == 'input') {
- td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input " + rowhelper_onChange + " class='formfld unknown' size='" + objectSize + "' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'></input> ";
+ td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input " + rowhelper_onChange + " class='formfld unknown' size='" + size + "' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'></input> ";
} else if(rowtype[i] == 'password') {
td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input " + rowhelper_onChange + " class='formfld pwd' type='password' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'></input> ";
}

0 comments on commit de69fab

Please sign in to comment.