Hi,
I am trying to use this function to get the for data :
[CODE=javascript]function getform(divid) {
var getstr='';
var obj=document.ge tElementById(di vid)? document.getEle mentById(divid) : document.forms[divid];
for (i=0; i<obj.childNode s.length; i++) {
if (obj.childNodes[i].tagName == "INPUT") {
if (obj.childNodes[i].type == "text") {getstr +="&" + obj.childNodes[i].name + "=" + obj.childNodes[i].value;}
if (obj.childNodes[i].type == "hidden") {getstr +="&" + obj.childNodes[i].name + "=" + obj.childNodes[i].value;}
if (obj.childNodes[i].type == "password") {getstr +="&" + obj.childNodes[i].name + "=" + obj.childNodes[i].value;}
if (obj.childNodes[i].type == "checkbox") { if (obj.childNodes[i].checked) {getstr +="&" + obj.childNodes[i].name + "=" + obj.childNodes[i].value;} else { getstr +="&" + obj.childNodes[i].name + "=off"; }}
if (obj.childNodes[i].type == "radio") { if (obj.childNodes[i].checked) {getstr +="&" + obj.childNodes[i].name + "=" + obj.childNodes[i].value;} else { getstr +="&" + obj.childNodes[i].name + "=off"; }}}
if (obj.childNodes[i].tagName == "SELECT") {var sel = obj.childNodes[i]; getstr +="&" + sel.name + "=" + sel.options[sel.selectedInd ex].value;}}
return getstr;}
[/CODE]
where the id or the name of the form is sent to this function and values are returned.
it works ok,
but when my fields are in a table it doesn't work, it finds the "table" tag as the childnode instead of input or select.
how can i make this work with tables?
I am trying to use this function to get the for data :
[CODE=javascript]function getform(divid) {
var getstr='';
var obj=document.ge tElementById(di vid)? document.getEle mentById(divid) : document.forms[divid];
for (i=0; i<obj.childNode s.length; i++) {
if (obj.childNodes[i].tagName == "INPUT") {
if (obj.childNodes[i].type == "text") {getstr +="&" + obj.childNodes[i].name + "=" + obj.childNodes[i].value;}
if (obj.childNodes[i].type == "hidden") {getstr +="&" + obj.childNodes[i].name + "=" + obj.childNodes[i].value;}
if (obj.childNodes[i].type == "password") {getstr +="&" + obj.childNodes[i].name + "=" + obj.childNodes[i].value;}
if (obj.childNodes[i].type == "checkbox") { if (obj.childNodes[i].checked) {getstr +="&" + obj.childNodes[i].name + "=" + obj.childNodes[i].value;} else { getstr +="&" + obj.childNodes[i].name + "=off"; }}
if (obj.childNodes[i].type == "radio") { if (obj.childNodes[i].checked) {getstr +="&" + obj.childNodes[i].name + "=" + obj.childNodes[i].value;} else { getstr +="&" + obj.childNodes[i].name + "=off"; }}}
if (obj.childNodes[i].tagName == "SELECT") {var sel = obj.childNodes[i]; getstr +="&" + sel.name + "=" + sel.options[sel.selectedInd ex].value;}}
return getstr;}
[/CODE]
where the id or the name of the form is sent to this function and values are returned.
it works ok,
but when my fields are in a table it doesn't work, it finds the "table" tag as the childnode instead of input or select.
how can i make this work with tables?
Comment