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.pleas e help at the earliest.Thank you.
dependent Combo box in AJAX
Collapse
X
-
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.Originally posted by galamansihi,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.pleas e 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.Originally posted by galamansihi,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.pleas e help at the earliest.Thank you.Comment
-
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.Originally posted by JacotheronIf 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.
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.Comment
Comment