Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Reset data

Reply
Thread Tools

Reset data

 
 
Randy Webb
Guest
Posts: n/a
 
      02-29-2004
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/
 
Reply With Quote
 
 
 
 
Shabam
Guest
Posts: n/a
 
      02-29-2004
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?



 
Reply With Quote
 
 
 
 
Shabam
Guest
Posts: n/a
 
      02-29-2004
Is there a way to do this by a link instead of a button?


"Randy Webb" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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/



 
Reply With Quote
 
Shabam
Guest
Posts: n/a
 
      02-29-2004
One more thing, is it possible to reset just a subset of items within a form
instead of everything?



 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      02-29-2004
Shabam wrote:
> "Randy Webb" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>>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/
 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      02-29-2004
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=e...ang.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/
 
Reply With Quote
 
Shabam
Guest
Posts: n/a
 
      02-29-2004
> 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=e...ang.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.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
You will not be able to reset the access - can't reset. jc MCAD 0 12-09-2007 08:58 PM
CISCO 7XX / 761 password reset or reset to factory defaults Philipp Flesch Cisco 3 06-18-2006 07:47 PM
How to reset input data on detailsview, after error on insert jparlato ASP General 3 05-26-2006 01:36 PM
Connection Reset =?Utf-8?B?RGljb3Jwbw==?= Wireless Networking 0 10-08-2004 03:35 PM
Wireless Linksys Router Reset--What happened? =?Utf-8?B?TW9yZGlkbw==?= Wireless Networking 1 10-08-2004 11:28 AM



Advertisments