Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populating HTML select using JSON

 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have 3+ HTML Select inputs(Dropdowns) on one HTML. After changing one of them I want to update select options in other dropdowns based on the selection.
I am using Prototype to execute the AJAX call. I worked it out for two dropdowns wherein Ajax response contained only values for one of the dropdowns.
I am planning to send back values for all dropdowns in one server hit. I was looking at probable solutions, JSON being one of them.
I know that if I can send the JSON objects from server side I can use them to populate the Dropdown boxes.
The thing I want to know is there anyway in Prototype library/HTML DOM that can take JSON Array as an input to populate the HTML Select.

Regds
Amit
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. You'll need to iterate through the data and construct the option elements.
 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks Bear for prompt response.

Regds
amit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic