By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,521 Members | 1,222 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,521 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.