473,804 Members | 3,941 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question related to onchange function

68 New Member
Hi,
I am facing some problem with this onchange function with dropdown menu.
my task is:
i have one column in a table with dropdown menus. so all the cells of that column have dropdown menus. when the page is loaded these dropdown have some predefined values (suppose, there are 5 rows in the table and the values of the cells of that column is 1, 4,2,6,5). when i change any value of any dropdown menu then, an onchange() function is invoked. i want an array in the onchange() to have the list of the new_values of that column(suppose i change 6 to 3, then that array should hold, 1,4,2,3,5 instead of
1,4,2,6,5).
how do i do this.

Any help is appreciated.

Thank You!
Jul 11 '07 #1
1 1228
gits
5,390 Recognized Expert Moderator Expert
hi ...

let me give you an idea to achieve your goal ...

for easy access of your array-elements try to use an object (assoc. array) instead:

Expand|Select|Wrap|Line Numbers
  1. var hash_map = {'1': 1, '2': 1, '3': 1};
with that you may do the following things (assuming list_value is your selected value):

Expand|Select|Wrap|Line Numbers
  1. // delete an element of the map
  2. delete hash_map[old_list_value];
  3.  
  4. // put new value in the map
  5. hash_map[list_value] = 1;
  6.  
  7. // ask for a value in the map
  8. if (list_value in hash_map) {
  9.     // do something
  10. }
  11.  
  12. // or ask another way
  13. if (typeof hash_map[list_value] != 'undefined') {
  14.     // do something
  15. }
  16.  
try something with that ... and in case you have more questions, post your approach and we may help you with further details ...

kind regards
Jul 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
1393
by: Calan | last post by:
Mike, Your code on the dynamic input checking was excellent and very well explained. (The only thing I had to do was change the test for text input to be "1 > len of text", instead or "0 > length of text", and add a line to store the result for use on the server). Thank you very much! I have a related issue that you might have some ideas on. In some cases, I have a select box where one of the selections may require an additional input...
6
2413
by: Bonge Boo! | last post by:
This has got to be obvious, but I can't make it work. I have a form called with 3 pull down menus. They are linked to a database which generates the values for the <SELECT? Pull-downs. Lets say I have values selected for all three pull down menus. When I change the first "top-level" menu I want to reset both the second and third menus to the "default" state.
9
2175
by: beguigne | last post by:
Below is a snippet of a crude date picking routine for a form. I am a novice at this so, I am hitting my head at why when I select the day, the onChange event gives me a blank. What am I missing? Regards, <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>
8
1554
by: George | last post by:
I need help with the code listed below. See the line below the comment-// *** This displays the error *** I want to be able to have the event handler call the function based on the reference that I pass to my objects member function. This works ok as long as I do not try to pass any arguments. How can I have the event call the function reference with variables? See addEventHandler( ) function below...
2
2167
by: joltman | last post by:
OK, this is kind of hard to explain, so I'll do my best: I have a form where I have a row where there could be multiple entries, so I have a link where it will dynamically add another row like it, and this can happen as many times as you click on the link. This row consists of 2 drop-down boxes. Depending on the selection of the first drop-down box, the second drop-down box is either disabled or enabled. The problem is on these dynamically...
2
3899
by: Sally B. | last post by:
Hi, I have a main page that opens a pop up window when the user clicks a link. The pop up window is a menu and when the user clicks the item, it populates a form input element on the 'parent' window. My question is: this new populated form element is the value that I use to change a style. onchange does not watch this form element because of getelementbyid, so
0
1196
by: swatikumari | last post by:
Hi,iright now i am facing one problem i.e... in my asp page i have two combo on selection of first combo it is going filter data in second combo which is pick form database.my problem is that when select any item in both combo it not able to show selected item in combo...i am sending my code..any one help me... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
21
29835
by: Leena P | last post by:
i want to basically take some information for the product and let the user enter the the material required to make this product 1.first page test.php which takes product code and displays prodcut anme have used ajax to avoid refreshing of page this works fine 2.now i have created one row with checkbox|select box|text|text|text|text| where in the select box values are fetched from table here also i have used ajax for getting the m_name...
8
1489
by: sheldonlg | last post by:
I am still improving my AJAX and I ran into something that I'm not sure how to do. I will have a page called where I will have a dropdown list at the top and a large display at the bottom. The display depends upon what is currently selected in the dropdown. This is readily done via AJAX which is activated with an onchange in the dropdown list. The contents of the bottom half of the page are created in the php script which is sent back...
0
9706
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
9584
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
10337
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
10323
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
10082
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...
1
7622
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
6854
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
5525
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
3822
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.