Reset data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shabam

    Reset data

    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?



  • Randy Webb

    #2
    Re: Reset data

    Shabam wrote:
    [color=blue]
    > 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?
    >[/color]

    <input type="reset" value="Start Over" />
    Thats what a reset button does :)
    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javas cript FAQ - http://jibbering.com/faq/

    Comment

    • Shabam

      #3
      Re: Reset data

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


      "Randy Webb" <hikksnotathome @aol.com> wrote in message
      news:X72dnVvwA8 ebj9_dRVn-gg@comcast.com. ..[color=blue]
      > Shabam wrote:
      >[color=green]
      > > I have a text field that's pre-filled with data. Suppose the user edits[/color][/color]
      it,[color=blue][color=green]
      > > but decides he wants to reset the data back to the original pre-filled[/color][/color]
      data,[color=blue][color=green]
      > > how can I do that?
      > >[/color]
      >
      > <input type="reset" value="Start Over" />
      > Thats what a reset button does :)
      > --
      > Randy
      > Chance Favors The Prepared Mind
      > comp.lang.javas cript FAQ - http://jibbering.com/faq/[/color]


      Comment

      • Shabam

        #4
        Re: Reset data

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



        Comment

        • Randy Webb

          #5
          Re: Reset data

          Shabam wrote:[color=blue]
          > "Randy Webb" <hikksnotathome @aol.com> wrote in message
          > news:X72dnVvwA8 ebj9_dRVn-gg@comcast.com. ..
          >[color=green]
          >>Shabam wrote:
          >>
          >>[color=darkred]
          >>>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?
          >>>[/color]
          >>
          >><input type="reset" value="Start Over" />
          >>Thats what a reset button does :)[/color]
          > Is there a way to do this by a link instead of a button?
          >
          >[/color]

          Read the FAQ with regards to top-posting.

          <a href="" onclick="docume nt.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.javas cript FAQ - http://jibbering.com/faq/

          Comment

          • Randy Webb

            #6
            Re: Reset data

            Shabam wrote:
            [color=blue]
            > One more thing, is it possible to reset just a subset of items within a form
            > instead of everything?[/color]

            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.



            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.javas cript FAQ - http://jibbering.com/faq/

            Comment

            • Shabam

              #7
              Re: Reset data

              > And you are wanting to reset certain fields back to there defaults and[color=blue]
              > 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.
              >
              >[/color]
              http://groups.google.com/groups?hl=e...ang.javascript[color=blue]
              >
              > 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.[/color]

              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.



              Comment

              Working...