473,394 Members | 1,956 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,394 software developers and data experts.

Netscape7.1 order of onchange()/onsubmit() events WRONG

I have been going round in circles trying to get this to work.....

I have a form with many fields, each with an onchange() event. There
is also an onclick event on the form Submit button.
If one changes a field and goes immediately to the Submit button, then
the onsubmit() function gets called before the onchange()function.
This leads to the field not getting validated correctly. If you go to
any other field in the form, but not the submit button, it is fine.
This problem is only in Netscape7.1, IE is absolutely fine.
Any help greatly appreciated! Thanks in advance,
Lynn
Jul 23 '05 #1
4 1780
On 13 Sep 2004 09:35:50 -0700, Lynn <ru******************@hotmail.com>
wrote:
I have been going round in circles trying to get this to work.....

I have a form with many fields, each with an onchange() event. There is
also an onclick event on the form Submit button. If one changes a field
and goes immediately to the Submit button, then the onsubmit() function
gets called before the onchange()function.
This leads to the field not getting validated correctly. If you go to
any other field in the form, but not the submit button, it is fine. This
problem is only in Netscape7.1, IE is absolutely fine.


I can't replicate this in Netscape 7.2, so if it is a bug, it's been
fixed. Could you show a simple version of the code and HTML you're using,
which still displays the problem?

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
ru******************@hotmail.com (Lynn) wrote in message news:<1d**************************@posting.google. com>...
I have been going round in circles trying to get this to work.....

I have a form with many fields, each with an onchange() event. There
is also an onclick event on the form Submit button.
If one changes a field and goes immediately to the Submit button, then
the onsubmit() function gets called before the onchange()function.
This leads to the field not getting validated correctly. If you go to
any other field in the form, but not the submit button, it is fine.
This problem is only in Netscape7.1, IE is absolutely fine.
Any help greatly appreciated! Thanks in advance,
Lynn


When the submit button is pressed, create a timeout
{window.validate_flag=false; setTimeout("submit_to()",200)} event and
wait about 200ms before running the code. Have your validation code
set a flag that the if there is a validation block. Have the timeout
script read for the flag being set and handle as necessary.
Jul 23 '05 #3
On Mon, 13 Sep 2004 09:35:50 -0700, Lynn wrote:
I have been going round in circles trying to get this to work.....

I have a form with many fields, each with an onchange() event. There is
also an onclick event on the form Submit button. If one changes a field
and goes immediately to the Submit button, then the onsubmit() function
gets called before the onchange()function. This leads to the field not
getting validated correctly. If you go to any other field in the form, but
not the submit button, it is fine. This problem is only in Netscape7.1, IE
is absolutely fine.
Any help greatly appreciated! Thanks in advance, Lynn


You should _NEVER_ rely solely on client-side verification. Every web
page should work whether the user has JavaScript enabled or not.
Scripting should only be used to enhance the browsing experience.

Your server (CGI, PHP, ASP, etc) should also verify its input, just in
case JavaScript was disabled or if someone spoofed your form.

HTH,
La'ie Techie

Jul 23 '05 #4
JRS: In article <1095232552.cZc+BJ+L2P98owmOEXcEjA@teranews>, dated
Wed, 15 Sep 2004 01:15:59, seen in news:comp.lang.javascript, =?UTF-
8?b?TMSByrtpZSBUZWNoaWU=?= <laie@win_remove_get_nospam_solutions.com>
posted :
You should _NEVER_ rely solely on client-side verification. Every web
page should work whether the user has JavaScript enabled or not.
Scripting should only be used to enhance the browsing experience.
Nonsense. Some pages are only possible with scripting running; and some
are designed to be used client-side without post-delivery support from a
server. Never use "never" unless you really mean it.

Consider, for example, <URL:http://www.merlyn.demon.co.uk/js-clndr.htm>,
which has no significant content (bar the links to other pages) without
script running.

Your server (CGI, PHP, ASP, etc) should also verify its input, just in
case JavaScript was disabled or if someone spoofed your form.


If there is a server, and if the correct operation is of real interest
to server-side people, then there should be server-side verification.
But if spoofing has no effect other than on the spoofer, server-side
verification is not needed. Consider the situation where the
calculating engine for js-clndr.htm was server-side : a user enters
spoofed data and gets spoofed results - as is appropriate. (It may be
necessary to trap data that would harm the server, for example by
hogging resources.)
While Web pages and javascript are often used in support of business
transactions, it is a mistake to assume that they always are.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #5

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

Similar topics

2
by: F. Da Costa | last post by:
Hi, I'm trying to call/ mimic an onchange function/ event after a user has clicked a checkbox. In response to which a buncch of other ones need to be checked as well. The caveat is that each of...
13
by: aundro | last post by:
Hello, I've been looking on the web for a solution to this problem: I create a set of checkboxes, and 2 buttons: - one is labeled "All" - the other is labeled "None" Clicking "All" is...
3
by: jab3 | last post by:
Hello. I"m new to this group, and to JavaScript in general, so please forgive me if I breach local etiquette. I'm trying to implement some client-side 'dynamic' validation on a form. I'm having...
4
by: David McNerney | last post by:
Would anyone be able to tell me why I get an error in FireFox 1.5.0.1 for MacOSX when I type some text and hit Enter in the following form: <html> <body> <form action="http://example.com"...
2
by: William Cole | last post by:
Here is my issue I have two text fields (Field A, Field B). I want Field B to be updated when Field A is changed. The problem is Field A is being changed through JavaScript so an onChange event...
2
by: Mark | last post by:
Sorry for the double post, but I got no responses from the first group... I have a sample page. See link. http://comptrex.com/star/startest.htm It has a select box that contains a list of...
2
by: Wolf Grossi | last post by:
Hi folks, onsubmit a form is scanned tru all elements and the element is checked if it has onchange set. If so, onchange is executed. Assuming onchange looks like onchange=function...
1
by: sourav08 | last post by:
hi, I'm facing a problem in Mozilla which is ok in Ie. I have few input boxes in my page. After entering some text in one field and pressing the enter key, Onchange event is called for every...
1
by: vunet | last post by:
I write a JS library component which is applied to every form on a webpage. The component does something before it submits the form. Now, let's say user has his own onSubmit() handlers returning...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.