473,484 Members | 1,687 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Does submit count as an onChange event ?

I've become suspicious that the submit button does not count as an
onChange event in some browsers. Here's why.

I have a form with many textareas. After you click submit, I only
update the database with those textareas which were changed.

Thus, each textarea has an onChange event which marks that box as
changed.

BUT! Some users report that, if they don't take their cursor out of
the last text box they were editing, the text in that last textarea
does not get written to the database. (In other words, the onchange
event in that last textarea never got triggered.)

My question: With some browsers, if you leave your cursor parked in
the last box you were editing, and then press submit, why is onChange
not being triggered?

Thanks to all who respond,
Steve
Jul 20 '05 #1
2 2238
In article <aa**************************@posting.google.com >, sw*****@rof.net
(S Wickes) writes:
BUT! Some users report that, if they don't take their cursor out of
the last text box they were editing, the text in that last textarea
does not get written to the database. (In other words, the onchange
event in that last textarea never got triggered.)

My question: With some browsers, if you leave your cursor parked in
the last box you were editing, and then press submit, why is onChange
not being triggered?


What you are experiencing is a timing issue.

Cursor is in text area, mouse pushes down on the Submit button, the onChange
gets fired, the form gets submitted. If the form happens to get submitted
before JS has time to mark the field as changed, you get the behavior you
describe.

Without going into a diatribe about relying on javascript, one possible
solution is instead of a submit button, use a normal input type=button and set
its onclick to call a function that will setTimeout to wait 300 ms or so, and
then programatically submit the form. You would be surprised how much
javascript can get executed in 300ms.
--
Randy
Jul 20 '05 #2
> What you are experiencing is a timing issue.

Randy,

Thanks for your reply. What you say makes sense. Are certain browsers
or javascript versions more suceptible to this timing issue? This
problem always happens for some of my clients, and never happens for
others.

-Steve
Jul 20 '05 #3

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

Similar topics

3
7277
by: Matt | last post by:
The ASP page has a combo box with id list, and when user click the particular id, it will show the name in the text box. My attempt was when the user have event on combo box, it will call...
2
8653
by: Jason Novotny | last post by:
Hi, I'm trying to create a listbox using <select> HTML tags that can do a form submit when an option in the list is selected. So far this works, function MySelectSubmit() {...
9
2708
by: scott | last post by:
I have a combo in LISTING 2 that I'm trying to force a sumbit when a user makes a change. Can anyone see why it doesn't fire LISTING 2 code? It just doesn't do anything. What I'm really trying to...
6
2722
by: charlie_M | last post by:
I figured out via various help from this forum... EXAMPLE: onClick="document.forms.MYBUTTON.value='SIMPLE';document.forms.submit()" In my CGI I see "MYBUTTON" = "SIMPLE" and this works...
5
3437
by: Pascal Batzli Jr | last post by:
Hello, I have a strange situation happening on the code below. When I first load the page, as I change any of the three combo boxes I have created, the onchange event is fired and the form should...
2
1871
by: Gayathri | last post by:
Please find the pasted html, <html> <script language="JavaScript" src="cal.js"></script><!-- Date only with year scrolling --> </head> <BODY onLoad="showDetails()"> <script...
5
2234
by: awebguynow | last post by:
to submit or not to submit - that is the question and I'm going to be designing some lengthy forms, where many of the fields may be populated with data, and the user may only want to view it. ...
2
4641
by: somaskarthic | last post by:
Hi In my php code , i dynamically created table rows on button click event. Each row contain 3 selectboxes, 7 checkboxes . On each click of these elements i need to submit the form and save the...
2
4276
by: bips2008 | last post by:
The code seems to work fine in other browser but in IE it throws this error. This is very urgent for me and any help would be greatly appreciated For your convienence i have posted the code for the...
0
7079
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
6949
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
7103
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6809
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
7194
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...
0
3044
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3038
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
587
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
234
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.