Looping through all Form Elements

Discussion in 'Javascript' started by Mel, Aug 16, 2006.

  1. Mel

    Mel Guest

    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
     
    Mel, Aug 16, 2006
    #1
    1. Advertising

  2. 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;
    /*******************************
    Work with current control
    ********************************/
    }
    }
    But you cannot save nothing in file with JavaScript. Only in Internet
    Explorer this is possible with AxtiveX control.
    Mel напиÑа:
    > 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, Aug 16, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aemca
    Replies:
    1
    Views:
    580
    Aemca
    Jul 22, 2003
  2. Steven K

    Looping through form elements

    Steven K, Nov 12, 2003, in forum: ASP General
    Replies:
    3
    Views:
    111
    Randy Rahbar
    Nov 13, 2003
  3. dkmd_nielsen
    Replies:
    5
    Views:
    165
    dkmd_nielsen
    Mar 8, 2007
  4. Nate St.germain
    Replies:
    2
    Views:
    130
    Nate St.Germain
    Jun 1, 2010
  5. DoomedLung

    Looping through form elements

    DoomedLung, Sep 22, 2006, in forum: Javascript
    Replies:
    3
    Views:
    110
    DoomedLung
    Sep 23, 2006
Loading...

Share This Page