Click to See Complete Forum and Search --> : Form Fields concatenation


mili
07-31-2003, 07:16 PM
I have a form in which my xsl generates unique field names with sequence numbers.
HP1, HP2, HP3......HPn
VP1, VP2, VP3.....VPn

I have plenty of fields in my form, but I'm interested only with the names that starts with HP & VP.I want to be able to loop thro' the form elements and grab only these two sets of field names and concatenate them this way:
HP1;VP1
HP2;VP2

It looks too complicated for me.Pls can some 1 help me

Thanks

Khalid Ali
07-31-2003, 10:01 PM
var frm = document.formName;
var len = frm.length;

//now run a loop

for(var x=0;x<len;x++){
if(frm[x].name.indexOf("HP") ||
frm[x].name.indexOf("HP")){
alert("Elemenet found name = "+frm[x].name);
}
}

this should do it..:D

mili
08-01-2003, 08:01 PM
Thanks Khalid :)