By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,933 Members | 1,243 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,933 IT Pros & Developers. It's quick & easy.

dependent Combo box in AJAX

P: 1
hi,i would like to know how to fill a combobox2 in struts2 using AJAX depending on a particular value in the combobox1.Only the combobox2 should get refreshed everytime.please help at the earliest.Thank you.
Feb 1 '08 #1
Share this Question
Share on Google+
3 Replies


Jacotheron
P: 44
hi,i would like to know how to fill a combobox2 in struts2 using AJAX depending on a particular value in the combobox1.Only the combobox2 should get refreshed everytime.please help at the earliest.Thank you.
If I have a problem like this (where a lot of people get the same problem), I usualy go to http://javascript.internet.com. On this site I get the scripts that are allready programmed. They can even send you the scripts by e-mail etc. Here's a link to the pages I would suggest according to your query: http://javascript.internet.com/navig...-comboxes.html, http://javascript.internet.com/navig...pdown-box.html. The script needs to be retyped in order to work if a change has been made.
Feb 2 '08 #2

acoder
Expert Mod 15k+
P: 16,027
hi,i would like to know how to fill a combobox2 in struts2 using AJAX depending on a particular value in the combobox1.Only the combobox2 should get refreshed everytime.please help at the earliest.Thank you.
If you want to use Ajax for this, trigger your Ajax request function in the onchange event handler for the first combobox. The Ajax function should make a request to a server-side script which returns the options, either as an HTML snippet which you just set to combobox2 or as XML or JSON which you will need to parse.
Feb 3 '08 #3

acoder
Expert Mod 15k+
P: 16,027
If I have a problem like this (where a lot of people get the same problem), I usualy go to http://javascript.internet.com. On this site I get the scripts that are allready programmed. They can even send you the scripts by e-mail etc. Here's a link to the pages I would suggest according to your query: http://javascript.internet.com/navig...-comboxes.html, http://javascript.internet.com/navig...pdown-box.html. The script needs to be retyped in order to work if a change has been made.
Those links don't use Ajax. All the data is already stored within JavaScript arrays. That is an alternative way - it's not always necessary to use Ajax for every task.

Just a note on using ready-made scripts. Some are not really up-to-scratch. Check the date and look for browser detection. Some are too old and not up to date.
Feb 3 '08 #4

Post your reply

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