Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problem with method reset()

0 views
Skip to first unread message

artev

unread,
Apr 27, 2008, 7:48:53 PM4/27/08
to
if in a page I have a search form and I want use the method reset()
for reinsert the default values, I notice that after a research, for
the method reset(), the default values aren't more that first time loaded
in the form but that of the form set for the search (I think so);


see that the form is inner the same result's page, pheraphs
the reset() 'see' how default values only the last form and not those
that is loaded initially;

is there some tip?

GArlington

unread,
Apr 28, 2008, 9:52:28 AM4/28/08
to

Method reset() will set all values back to what it was ON page LOAD,
so if you want it to behave the way you describe (if I understand it
correctly) you can:
1) provide your own reset() function
example code
<input type="..." defaultValue="..." value="..." />
...
<input type="reset" onclick="myReset()" ... />
in you function take values from defaultValue attribute and assign it
to value attribute...
2) if you DO NOT want to override the reset() function you can load
the page with default values and set current (search specific) values
in onLoad script, then std reset() will work the way you want...

VK

unread,
Apr 28, 2008, 10:05:53 AM4/28/08
to

Please stop posting identical queries. In the run of a couple of days
you have posted four nearly identical queries:

memorize form settings
http://groups.google.com/group/comp.lang.javascript/msg/e9a6221ff7eb4e27

memorize all form's setting
http://groups.google.com/group/comp.lang.javascript/msg/0becc3c9df98ef78

regards method reset()
http://groups.google.com/group/comp.lang.javascript/msg/928318271cfc1148

problem with method reset()
http://groups.google.com/group/comp.lang.javascript/msg/b99de1d38692ce5e


That creates broken threads all around: please choose one - possibly
this one - where you will be collecting answers and providing extra
info if asked.

For the question itself it was clearly answered in the very first
thread: use reset().
If reset doesn't work for you than you don't want to restore form's
default values but you are willing to do something else what you
failed to express so far.

artev

unread,
Apr 29, 2008, 11:23:54 AM4/29/08
to
> Method reset() will set all values back to what it was ON page LOAD,
> so if you want it to behave the way you describe (if I understand it
> correctly) you can:
> 1) provide your own reset() function
> example code
> <input type="..." defaultValue="..." value="..." />
> ...
> <input type="reset" onclick="myReset()" ... />
> in you function take values from defaultValue attribute and assign it
> to value attribute..

problem is that first time I load page I achieve default value with
javascript;
but when I click submit for make search, also the file
javascript is reload so I haven't more my defalut value;
is possible to have static variable in javascript?


> 2) if you DO NOT want to override the reset() function you can load
> the page with default values and set current (search specific) values
> in onLoad script, then std reset() will work the way you want...

can explain better?
thanks

0 new messages