On Wed, 07 Mar 2007 11:00:16 +0100, <pr***********@gmail.comwrote:
>
function submitPartsForm(str) {
var count=document.getElementsByName("partId");
for(var i=0;i<count.length;i++)
{
document.mylist.myNum[i].value= document.getElementsByName("partNum")
(i).value;
}
document.forms["mylist"].submit();
}
myNum[] is a hidden variable and partNum is the name of a text field
that has many instances i mean there are many textfields with the same
name so it forms a column in a data table.
One way would be to join the text values together using a join character
unlikely to appear in the texts, like so:
function submitPartsForm() {
var theNodeList = document.getElementsByName("partId");
var theNodeValues = document.forms["myList"].elements["theNodeValues"];
if(theNodeList&&theNodeValues) {
for (var i=0;i<theNodeList.length;i++) {
if (theNodeList[i].value) {
theNodeValues.value += ("|" + theNodeList[i].value.toString());
}
}
document.forms["myList"].submit();
}
}
(Above script assumes the form has a hidden input (not disabled), named
"theNodeValues".)
Then in your server-side script you can use whatever method your language
uses to split the string into parts using the "|" as a split character.
Usually this results in an array.
--
Using Opera's revolutionary e-mail client:
http://www.opera.com/mail/