wood burning stoves 2.0*
The moose likes Struts and the fly likes dependable or linked dropdown lists Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "dependable or linked dropdown lists" Watch "dependable or linked dropdown lists" New topic
Author

dependable or linked dropdown lists

slav agui
Greenhorn

Joined: Jan 15, 2008
Posts: 4
Hello,
I have list and its options are going to change depending of user's selection. Since the list is small what I want is to have into an array or hidden dropdown list my original option list and Region list is going to have the user's available options.
Right now I have the dropdown list and is getting the values from a collection. But I don't know how to get the values from the collection and store all the options in a array or hidden dropdown list.

<html:select property="region" size="1" styleClass="searchtext" onchange="weeknumber[0].selected=true;" value="All" >
<html ptions collection="regionlist" property="value" labelProperty="label" />
</html:select>

Hope any of you can help me,
Thank You!!!
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I was going to suggest that you search the web for solutions. I know that there are some useful pages out there, but it seemed like most of the hits I could turn up dealt with Ajax solutions.

I worked in a project several years ago that used some JavaScript to generate dependant lists. I pulled up some source code and found an example. This is from a page where the user selected a year first and a list of car models was populated.

This is the JavaScript part. Note the logic:iterate tags which build the array of model records are runtime. The setModelDropList then populates the model list with just the records that match the selected year.


Here are the select tags. Note that the setModelDropList function is called in the onchange event of the year list. The logic:iterate tag in the model list would populate the list with the initial values from the form.


- Brent

Edited to add some line breaks.
[ January 16, 2008: Message edited by: Brent Sterling ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dependable or linked dropdown lists