Connecting Tech Pros Worldwide Help | Site Map

Looping through all Form Elements

  #1  
Old August 16th, 2006, 08:15 PM
Mel
Guest
 
Posts: n/a
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

  #2  
Old August 16th, 2006, 09:05 PM
Georgi Naumov
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping through all the form fields in the code behind ? Aemca answers 1 November 17th, 2005 07:09 PM
How to loop through FORM elements? Brett answers 2 November 17th, 2005 02:34 AM
Choosing visible form elements Anna answers 1 July 20th, 2005 12:56 PM
Looping Through Forms: Best Practice David answers 4 July 20th, 2005 11:39 AM