I just finished an application that did this very thing.  In my case it 
was companies -> groups -> areas...

We did it by using javascript and a dispatchaction.  We had a lot of 
data so embedding it all in the page was going to be yucky...  In a 
nutshell here is what I did:

* The user links to the action to get the form

* The action builds a select for the companies and returns a "continue" 
mapping. 

* The form displays and checks for the presence of each (company, group, 
area) and displays a select box if any are present.  In this case only 
group shows up

* The user selects a Company...  An onclick event sets a hidden field 
called action to "companyChange" and submits the form automatically

* The action sees that the companyChanged and populates a group select 
based on the new company and "continues".  It also removes any area 
selects present.

* The form checks to see if (company, group, area) are present - in this 
case company and group are so they get displayed.

* The user selects a group and the onclick sets the action field to 
groupChanged.  Submits it.

* The action sees that the groupChanged and populates an area select 
based on the new company/group and "continues". .

* The form checks to see if (company, group, area) are present - in this 
case all are present and they are all displayed

* If the user goes and changes say the company then it registers as a 
companyChanged and the action will remove the group and area and start 
over.

Its really not that bad...


I've also seen it done for states where its all in the page...  I think 
it was verizon or someone, where you selected the state and then a 
region...  It was all in javascript in the page itself...

Hmmm







-----Original Message-----
From: Nicolas.Desjardins [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 01, 2002 9:42 AM
To: struts-user
Subject: html select field change on the fly


Hi,
 
I have a form in witch there is 2 html select box (drop down lists).  
The
first one is a list of organisations, and the second is the list of the
divisions.  Is there a struts way of, when there is an organisation 
selected
in the first select, to change on the fly the second select with the
divisions of that organisation.  It's a common problem that appear when 
you
select a country and you want only the states of that country to appear 
in
the state choice and I can't find a practical solution to the problem.
 
Thx all,

---
Nicolas Desjardins
Analyste Programmeur / Analyst Programmer
TI-Télécom, EFRIC_2x4DS
* (514) 937-0102 ext. 6083
*  
<mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] 

"All you need is ignorance and confidence; then success is sure."
                                                            -- Mark Twain

 



--
To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: 
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to