aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Dropdown populates other fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Dropdown populates other fields" Watch "Dropdown populates other fields" New topic
Author

Dropdown populates other fields

Rob Lynn
Greenhorn

Joined: Jun 27, 2005
Posts: 28
Hi. I am have a dropdown 'select' that should populate several other fields on the page depending on which item was selected. My select objects come from a java object (I'm using jsps and jstl to iterate through the object list and populate the options.) Other fields in the java object would be the (default) values for the fields that are populated based on the selection. My intention is to populate arrays using javascript with the values contained in the object for each field and then use the selected index to access them and set the form values. My problem is how to get the extra fields out of the java object and into the javascript array. Here's where I'd like to do it:


How can I accomplish this? Thanks!
Mark Wuest
Ranch Hand

Joined: Jun 07, 2003
Posts: 88
I've done it two ways:

1 - create javascript arrays containing all possible values from within the java code

2 - use an ajax request to get new values.

Honestly, I've switched from 1 to 2.

Also honesly, I'm more a java guy that an html/javascript guy

Mark
 
Consider Paul's rocket mass heater.
 
subject: Dropdown populates other fields