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

L

Lynn

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
 
M

Michael Winter

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
 
J

Java script Dude

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.
 
D

Dr John Stockton

JRS: In article <1095232552.cZc+BJ+L2P98owmOEXcEjA@teranews>, dated
Wed, 15 Sep 2004 01:15:59, seen in =?UTF-
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top