Page 1 of 1

Retriving an array of all form

Posted: Mon May 16, 2005 9:49 am
by paolo
Hello,

I would like to know if there's a funcion or a simple way to retrieve an array of all forms field present in a form.
I've a form made of 20 field and want to reset all using a function instead of reset button; the reason is that the form can take parameters from session's variables but sometime I need to force the cleaning.For now I've done form.field1.value = "", form.field2.value = "" .... and so on bu since I would like to use that function for other forms I just ask myself if there's a way to take all the fields and then with a for cycle to clean them all.
Thanks
Paolo

Posted: Mon May 16, 2005 10:03 am
by hawleyjr

Posted: Mon May 16, 2005 2:21 pm
by paolo
I tryied to follow the example but the script doesn't work, it seems it's unable to get the lenght of items
alert(document.forms[0].elements.lenght ); gives a box with Undefined... anyone knows a possible reason?
Thanks
Paolo

Posted: Mon May 16, 2005 3:12 pm
by John Cartwright
Moved to Client Side

Posted: Mon May 16, 2005 5:31 pm
by andre_c
try length instead of lenght