Connecting Tech Pros Worldwide Help | Site Map

Looping through all Form Elements

Mel
Guest
 
Posts: n/a
#1: Aug 16 '06
I need to loop through all form elements such as text, radios, check
boxes and the like and to save their state in a file.

does anyone have JS code to do this ? It can help a bunch

thanks

Georgi Naumov
Guest
 
Posts: n/a
#2: Aug 16 '06

re: Looping through all Form Elements


You can easily iterate the elements colection.
"elements" is a collection, in source order, of all controls in a given
form. input type=image objects are excluded from the collection. For
example:
function handleFormControls(aFormObj){
if(aFormObj.tagName != "FORM")
return;
for(i=0;i<aFormObj.elements.length;i++)
{
var currEl=aFormObj.elements[i];
/*******************************
Work with current control
********************************/
}
}
But you cannot save nothing in file with JavaScript. Only in Internet
Explorer this is possible with AxtiveX control.
Mel написа:
Quote:
I need to loop through all form elements such as text, radios, check
boxes and the like and to save their state in a file.
>
does anyone have JS code to do this ? It can help a bunch

thanks
Closed Thread