• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Adding form:option dynamically

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using 2 <form:select> tags on my jsp page, one for list of countries & other for list of states in that country. What I am doing is, once a country is selected, then through dwr I am calling my controller & getting back list of state objects. Each state object is populated with name & code of state. Now I want to add the state list names & code to the <form:select> related to state. I could not find any way to add this dynamically. Can anyone give me any suggestions or hints?

I have tried to use dwr API as follows:-
for(var i =0; i<data.length;i++){
dwr.util.addOptions(selectbox, [data[i].name]);
}
But this will add ><option> tag & not <form:option> tag.
reply
    Bookmark Topic Watch Topic
  • New Topic