473,799 Members | 3,080 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing selectedIndex and onchange events

Whilst I have no immediate need for it, I've noticed that if a select
element is changed via setting the selectedIndex value, it does not
fire an onchange event. Is there any reason for this? Both IE 6 and FF
2 behave the same in regards to this.

Is it the developers responsibility to fire this event in such a
situation?

Mar 20 '07 #1
2 9498
VK
On Mar 20, 7:55 pm, "Tom Cole" <tco...@gmail.c omwrote:
Whilst I have no immediate need for it, I've noticed that if a select
element is changed via setting the selectedIndex value, it does not
fire an onchange event. Is there any reason for this?
At least for IE there is:
http://msdn.microsoft.com/workshop/a...s/onchange.asp
"The onchange event does not fire when the selected option of the
select object is changed programatically ."

I don't remember if it is some standard DOM interface feature or a
"default common behavior" of all browsers. From the practical point of
view it is not so relevant though.
Both IE 6 and FF 2 behave the same in regards to this.
Yes, see above.
Is it the developers responsibility to fire this event in such a
situation?
I'm afraid so. And remember that custom events do not propagate
(bubble) so you have to fire them for each event consumer separately.

Mar 20 '07 #2
On Mar 21, 2:55 am, "Tom Cole" <tco...@gmail.c omwrote:
Whilst I have no immediate need for it, I've noticed that if a select
element is changed via setting the selectedIndex value, it does not
fire an onchange event. Is there any reason for this? Both IE 6 and FF
2 behave the same in regards to this.

Is it the developers responsibility to fire this event in such a
situation?
The W3C event model provides dispatchEvent, IE provides fireEvent.
The archives are a remarkable resource - Michael Winter provides a
very comprehensive answer here:

subject: How to trigger event programmaticall y?
<URL:
http://groups.google.com.au/group/co...cea9cdf065a524
>

--
Rob

Mar 21 '07 #3

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

Similar topics

1
3013
by: Young-Soo Roh | last post by:
Hi. I need to get simple script working. I have many select object. When I select a different option, I would like to change the value of corresponding text input field. How can I do this using javascript? Here is what I have so far. <SELECT NAME=\"%s\" onChange=\"fill_desc(this.form, $name, $field_name)>
1
3441
by: MickG | last post by:
I am trying to change the value of the variable "hard" according to which radio button is pressed and I am having no joy. Could anyone help me with this, the problematic section is marked with ***********************, I've included all the code incase that isn't where the problem is. Any help would be hugely appreciated. Mick
1
1869
by: WebRaster | last post by:
I wish to know if is possible to change the selected option in a SELECT selecting a determined option into another SELECT in the same form. E.g: When I select the option "Istruction" in the SELECT named "A" I wish the SELECT "B" change the default state from "empty" to "other" Thank You
4
11850
by: KK | last post by:
Hi All... For my purpose, I need to handle listbox selection changed event.I must be notified before changing occurs and after.After I can handle using SelectedIndexChanged event.Is there anyway to know which one is selected item before this event.?One thing is I can have a variable to hold the index in my application. I'm looking exactly like TreeView events(which fires events before expanding and after expanding the nodes).
2
8096
by: Monty | last post by:
I use a SELECT dropdown as the nav interface for jumping to a chosen page number. When I setup up the SELECT element on the page, I want to show the user the current page number they are on, so, I put "selected" next to the page number, as shown below: ------------------------------- <form name="pick" method="post" action="showit.php"> <select name="pggo" onChange="this.options.selected;document.pick.submit();">
4
19627
by: Robert Bravery | last post by:
HI all, In JS, how can I change the selected value of a dropdownlist(select options) I know the value of indexed value of the selected value before it is changed. Thanks Robert
4
1307
by: Jessica | last post by:
Page: http://www.doublooncove.com/signup.php Problem: In Firefox, the changes work fine. In IE, the images just disappear, and there is a broken image. The images are THERE. Some are blank images (like placeholders, since the male character is shirtless, his shirt is blank). But they do exist. Here is a sample of the code, there are several of these functions but they're all the same just different parts.
3
2826
by: vivela | last post by:
hi, I hope you could help me out on this one,cause I have been trying for 4 days to solve it,but couldn't quite get it right: I have an ASP textbox that should change the value in a dropdownlist. this happens,but the problem is with the validation of the ddl.it has a requiredfieldvalidator,and the error message disapears only if i select a value from the dropdownlist,even though it should also disapear when I write a valid name in the...
0
9687
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
9541
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10228
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
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5463
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...
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.