473,609 Members | 2,296 Online
Bytes | Software Development & Data Engineering Community
+ 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 2254
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
7286
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 JavaScript showempname(), and it will then look up the name by executing SQL statement. However, the following code has the following error: Microsoft VBScript runtime (0x800A01A8) Object required on line " sqlStmt = "select * from employee where...
2
8666
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() { document.myform.submit(); }
9
2716
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 do is access the value of the combo after a user makes a change. I'm just hardcoding the teamID querystring in this example. LISTING 1 ------------- <script type=text/javascript>
6
2742
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 fine.... except that the element MYBUTTON must exist as a hidden field.
5
3452
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 be submitted, but it isn't for some weird reason. However, after I press the ok button, it submits the form, and then the combo boxes start working normally. In IE, everything works fine. I appreciate any help. Thank you. <html>
2
1895
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 language="javascript"> function validatePage(){
5
2241
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. In a perfect world, I'd have 2 buttons: Close and Submit - disabled and Submit would become enabled - immediately - if data was changed. otherwise the user could click "Close" and a php script could redirect (header) to Default pg.
2
4657
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 data to database. After each submit , i need to display the previous added details (with some checkboxes checked and some others unchecked ..) and one new row for next updation. Here i need to collect all values submitted in the php page. There i...
2
4292
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 file. The portion that is not working is the star rating part <?php session_start(); include_once('includes/host_conf.php'); include_once('includes/db_connect.php'); include_once('includes/mysql.lib.php');...
0
8126
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8563
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8210
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8394
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5507
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4013
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2527
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.