472,794 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,794 software developers and data experts.

FireFox: event handling problem

Problem with event handling in FireFox. I have two controls on HTML
page: ListBox and TextBox (<selectand <input>). Both controls have
event "onchange" and functions for this event (e.g. select_onchange
and text_onchage). If I select item in ListBox, than I enter text in
TextBox, and than I finally select other item in ListBox, then both
events fires simultaneously (it can be checked up, if in both
functions write a corresponding "alert", both alerts appear
simultaneously). How to solve this problem?
It is very important.

Thanks
Jan 17 '08 #1
4 3866
On Jan 17, 7:49*am, StepanM <stepmikhay...@yandex.ruwrote:
Problem with event handling in FireFox. I have two controls on HTML
page: ListBox and TextBox (<selectand <input>). Both controls have
event "onchange" and functions for this event (e.g. select_onchange
and text_onchage). If I select item in ListBox, than I enter text in
TextBox, and than I finally select other item in ListBox, then both
events fires simultaneously (it can be checked up, if in both
functions write a corresponding "alert", both alerts appear
simultaneously). How to solve this problem?
It is very important.
It is very important to realize that displaying an alert after a
change or blur event makes for an annoying and error-prone interface
(so don't do it.) Use the containing form's submit event for
validation.
Jan 17 '08 #2
StepanM wrote:
Problem with event handling in FireFox. I have two controls on HTML
page: ListBox and TextBox (<selectand <input>). Both controls have
event "onchange" and functions for this event (e.g. select_onchange
and text_onchage). If I select item in ListBox, than I enter text in
TextBox, and than I finally select other item in ListBox, then both
events fires simultaneously (it can be checked up, if in both
functions write a corresponding "alert", both alerts appear
simultaneously). How to solve this problem?
It is very important.
I have noted that..the onchange() doesn't trigger until you change
focus to another bit of the screen in some browsers in some situations.

I think I fixed it once by using onmouseout() and then checking which
option was selected, and if it wasn't already selected, triggering the
script I wanted.
Thanks
Jan 17 '08 #3
On Jan 17, 11:48*am, The Natural Philosopher <a...@b.cwrote:
StepanM wrote:
Problem with event handling in FireFox. I have two controls on HTML
page: ListBox and TextBox (<selectand <input>). Both controls have
event "onchange" and functions for this event (e.g. select_onchange
and text_onchage). If I select item in ListBox, than I enter text in
TextBox, and than I finally select other item in ListBox, then both
events fires simultaneously (it can be checked up, if in both
functions write a corresponding "alert", both alerts appear
simultaneously). How to solve this problem?
It is very important.

I have noted that..the onchange() *doesn't trigger until you change
focus to another bit of the screen in some browsers in some situations.

I think I fixed it once by using onmouseout() and then checking which
option was selected, and if it wasn't already selected, triggering the
script I wanted.
That would assume that a pointing device is in use. In any event, I
wouldn't recommend such an approach.
Jan 17 '08 #4
On Jan 17, 10:49*pm, StepanM <stepmikhay...@yandex.ruwrote:
Problem with event handling in FireFox. I have two controls on HTML
page: ListBox and TextBox (<selectand <input>). Both controls have
event "onchange" and functions for this event (e.g. select_onchange
and text_onchage). If I select item in ListBox, than I enter text in
TextBox, and than I finally select other item in ListBox, then both
events fires simultaneously (it can be checked up, if in both
functions write a corresponding "alert", both alerts appear
simultaneously). How to solve this problem?
It is very important.
Onchange can be difficult to program - it is supposed to fire when an
element loses focus, but some browsers don't wait for that for some
form controls while others do.

I expect what is happening in your case is that when you click on the
select the second time, that is when the text area loses focus and
fires its onchange event. Displaying the alert probably causes the
select to lose focus with perhaps a different option selected so it
too fires its onchange event.

You need to investigate using a different event for one or perhaps
both controls. Without knowing what you are actually trying to do, a
more precise solution can't be suggested.

Do you have a small example you can post, along with a description of
what you want to happen?
--
Rob
Jan 18 '08 #5

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

Similar topics

4
by: Eric | last post by:
How can I dynamically assign an event to an element? I have tried : (myelement is a text input) document.getElementById('myelement').onKeyUp = "myfnc(param1,param2,param3)"; ...
4
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form...
9
by: Ja NE | last post by:
(I'm not a programer, I have learned enough php to build my cms, but that doesn't make me coding guru, so please excuse me if I'm asking something trivail...) well, I have one upload form where...
7
by: Coder | last post by:
Hi I have the following code in java script, it is not giving proper output in FIREFOX but running fine in IE... can anybody help me out to make this run in FIREFOX . <script...
2
by: Serena | last post by:
I have a problem whit this script. It is compatible with IE but isn't with Firefox. The error are: 1) "e has no properties" at----- "if(e.pageX || e.pageY) {" 2) "document.getElementById()"...
2
by: yb | last post by:
I am attempting to modify the style of an element (its width) as the window is being resized, in firefox. Long story short, I've tried to use CSS but one particular part of the layout just won't...
1
by: jayturley | last post by:
I have a web page with the following items on it: <label for="commissionschedule"> Commission Schedule<br /> <span id="charCounter">1000 characters or less</span> </label> <textarea...
1
by: ehud37new | last post by:
this script work fine in IE but not in FireFox where is the problem? here is the script /*------------------------------------------------------------------ File: menu.js ...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.