473,385 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to catch reset of a form not before, but right after the event?

Hello. Can anybody read this and come up with the solution? I would
appreciate any input.

In my form I have two fields (Field1 is select and Field2 is text input).
Field1 has "onchange" event which fires a function which hides or displays
Field2 depending on chosen value of Field1 by means of manipulating style
"display" property setting it to "none" or "inline".

Everything works fine, but only problem is reset button. When Field1 is
reset then onchange for Field1 is not triggered. So, I have a situation when
Field2 is displayed or hidden when it should not be according to value
Field1.

I tried to use "onreset" event to put there the logic of hiding/displaying
of Field2, but this event seems to trigger BEFORE and not right AFTER reset.
So, I don't have reset value of Field1 at that moment.

Thanks
JS
Jul 20 '05 #1
2 5775
In article <ST*********************@nnrp1.uunet.ca>, so***@microsoft.com
enlightened us with...
Hello. Can anybody read this and come up with the solution? I would
appreciate any input.

In my form I have two fields (Field1 is select and Field2 is text input).
Field1 has "onchange" event which fires a function which hides or displays
Field2 depending on chosen value of Field1 by means of manipulating style
"display" property setting it to "none" or "inline".

Everything works fine, but only problem is reset button. When Field1 is
reset then onchange for Field1 is not triggered. So, I have a situation when
Field2 is displayed or hidden when it should not be according to value
Field1.


Call the same function when the user hits reset.

<input type="reset" onclick="whateverFunctionToClearBoxes();">
-------------------------------------------------
~kaeli~
Black holes were created when God divided by 0.
Not one shred of evidence supports the notion
that life is serious.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
Jul 20 '05 #2
In article <MP************************@nntp.lucent.com>, kaeli
<in********************@NOSPAMatt.net> writes:
Call the same function when the user hits reset.

<input type="reset" onclick="whateverFunctionToClearBoxes();">


Another alternative:

<input type="button" onclick="........">

And let the function use .reset() to programatically reset the form.
Then, you can control what order it gets reset in.

--
Randy
All code posted is dependent upon the viewing browser
supporting the methods called, and Javascript being enabled.
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Ken | last post by:
How can I reset the initial form variables that are set with session statements when clicking on a button? I tried this but the function was not called: <?PHP function reset_form($none) {...
5
by: RAJ | last post by:
hi plz tell me how to know "how window is going to close"... i have to right code for X button of forms... plz telll me thanks bye
1
by: Joe Bloggs | last post by:
I have a form which includes a checkbox field. I need to add a reset, I add a HTML reset it works fine before I submit the form but not after. I know I must add some code to reset the checkbox on...
7
by: Dan Bass | last post by:
In a somewhat complex application, I've developed plug-in architecture and am having a problem as to when to catch general exceptions for logging purposes. In each plug-in class library, for...
4
by: Lee Chapman | last post by:
Hi, Can anyone tell me why in the code below, the call to ClearChildViewState() has no effect? To paraphrase the code: I'm using view state. I have a textbox and a submit button (and a label...
5
by: Simon Tamman {Uchiha Jax} | last post by:
Now this is bugging me. I just released software for a client and they have reported an unhandled stack overflow exception. My first concern is that the entirity of the UI and any threaded...
16
by: sreemati | last post by:
Hi everyone, This is the scenario: I have two button - Submit and Reset Submit is used for validation and after validation is passed it passes it to another form to enter into database. ...
11
by: newbie | last post by:
i have a form in which a hidden field (initial value as '0', and my javascript set it to '1' when an event is trigged). In the same form, i have a reset field. But I realized that the hidden field...
5
by: vovan | last post by:
I have set of controls (Textboxes, checkboxes etc) along with the Grid on Windows Form. I use BindingSource to populate both Grid and the set of Controls. User selects the record in the grid and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.