Reset data

Discussion in 'Javascript' started by Randy Webb, Feb 29, 2004.

  1. Randy Webb

    Randy Webb Guest

    Shabam wrote:

    > I have a text field that's pre-filled with data. Suppose the user edits it,
    > but decides he wants to reset the data back to the original pre-filled data,
    > how can I do that?
    >


    <input type="reset" value="Start Over" />
    Thats what a reset button does :)
    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq/
     
    Randy Webb, Feb 29, 2004
    #1
    1. Advertising

  2. Randy Webb

    Shabam Guest

    I have a text field that's pre-filled with data. Suppose the user edits it,
    but decides he wants to reset the data back to the original pre-filled data,
    how can I do that?
     
    Shabam, Feb 29, 2004
    #2
    1. Advertising

  3. Randy Webb

    Shabam Guest

    Is there a way to do this by a link instead of a button?


    "Randy Webb" <> wrote in message
    news:...
    > Shabam wrote:
    >
    > > I have a text field that's pre-filled with data. Suppose the user edits

    it,
    > > but decides he wants to reset the data back to the original pre-filled

    data,
    > > how can I do that?
    > >

    >
    > <input type="reset" value="Start Over" />
    > Thats what a reset button does :)
    > --
    > Randy
    > Chance Favors The Prepared Mind
    > comp.lang.javascript FAQ - http://jibbering.com/faq/
     
    Shabam, Feb 29, 2004
    #3
  4. Randy Webb

    Shabam Guest

    One more thing, is it possible to reset just a subset of items within a form
    instead of everything?
     
    Shabam, Feb 29, 2004
    #4
  5. Randy Webb

    Randy Webb Guest

    Shabam wrote:
    > "Randy Webb" <> wrote in message
    > news:...
    >
    >>Shabam wrote:
    >>
    >>
    >>>I have a text field that's pre-filled with data. Suppose the user
    >>>edits it, but decides he wants to reset the data back to the
    >>>original pre-filled data, how can I do that?
    >>>

    >>
    >><input type="reset" value="Start Over" />
    >>Thats what a reset button does :)

    > Is there a way to do this by a link instead of a button?
    >
    >


    Read the FAQ with regards to top-posting.

    <a href="" onclick="document.forms['myForm'].reset();return false">Start
    Over</a>

    Or better, make your button appear as a link (which is a better solution).

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq/
     
    Randy Webb, Feb 29, 2004
    #5
  6. Randy Webb

    Randy Webb Guest

    Shabam wrote:

    > One more thing, is it possible to reset just a subset of items within a form
    > instead of everything?


    Read the FAQ with regards to quoting what you are replying to.

    And you are wanting to reset certain fields back to there defaults and
    leave others alone?

    Create an array that contains each fields original value when the page
    is loaded along with its default state (if it has one). Then loop
    through your form and set the .value or default state of the ones you
    want to reset.

    http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&group=comp.lang.javascript

    Is the c.l.j. archives on google, happy searching.

    What you want to find is:

    1) How to loop through the form elements.
    2) How to determine there type/value.
    3) How to create an array containing that data.
    4) How to "reset" it to its default state.
    Hint: That will involve determining its type, looking up its
    default state, and then resetting it.

    Radio Button, Checkbox, Select, Text Input(includes a textarea).

    Hopefully you will find your research an enlightening experience.

    If you get stumped, post back with a URL to your un-finished script for
    more guidance.

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq/
     
    Randy Webb, Feb 29, 2004
    #6
  7. Randy Webb

    Shabam Guest

    > And you are wanting to reset certain fields back to there defaults and
    > leave others alone?
    >
    > Create an array that contains each fields original value when the page
    > is loaded along with its default state (if it has one). Then loop
    > through your form and set the .value or default state of the ones you
    > want to reset.
    >
    >

    http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&group=comp.lang.javascript
    >
    > Is the c.l.j. archives on google, happy searching.
    >
    > What you want to find is:
    >
    > 1) How to loop through the form elements.
    > 2) How to determine there type/value.
    > 3) How to create an array containing that data.
    > 4) How to "reset" it to its default state.
    > Hint: That will involve determining its type, looking up its
    > default state, and then resetting it.
    >
    > Radio Button, Checkbox, Select, Text Input(includes a textarea).
    >
    > Hopefully you will find your research an enlightening experience.
    >
    > If you get stumped, post back with a URL to your un-finished script for
    > more guidance.


    Thanks for your help. Yes I'm trying to reset just fields back to its
    original. I'll do a bit more research and play with it.
     
    Shabam, Feb 29, 2004
    #7
    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. Martin Bammer
    Replies:
    0
    Views:
    626
    Martin Bammer
    Nov 17, 2003
  2. Weng Tianxiang
    Replies:
    7
    Views:
    1,128
    Mike Treseler
    Nov 25, 2003
  3. valentin tihomirov

    Is this trick with reset acceptable?

    valentin tihomirov, Apr 11, 2004, in forum: VHDL
    Replies:
    6
    Views:
    570
    Jim Lewis
    Apr 14, 2004
  4. valentin tihomirov
    Replies:
    9
    Views:
    2,513
    Ray Andraka
    Apr 15, 2004
  5. jparlato
    Replies:
    3
    Views:
    277
    jparlato
    May 26, 2006
Loading...

Share This Page