struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Desjardins, Nicolas" <Nicolas.Desjard...@microcell.ca>
Subject RE: html select field change on the fly
Date Thu, 01 Aug 2002 14:15:55 GMT
I've seen the javascript solution all over the internet and i dont find it
elegant. Your's seems really neat and flexible and i want all my data to
stay in the DB. 

I'll try to do something like this thanks a lot!

Nic

-----Original Message-----
From: wbchmura@Ensign-BickfordInd.com
[mailto:wbchmura@Ensign-BickfordInd.com]
Sent: Thursday, August 01, 2002 10:12 AM
To: struts-user@jakarta.apache.org
Subject: RE: html select field change on the fly



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:Nicolas.Desjardins@microcell.ca]
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:nicolas.desjardins@microcell.ca> nicolas.desjardins@microcell.ca 

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

 



--
To unsubscribe, e-mail:   
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: 
<mailto:struts-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message