And I need to know how can i update a drop-down field based on a selection made in another drop down field
4 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sergiu_Miruta
Posted On:   Thursday, June 16, 2005 07:19 AM

I'am trying to create a web aplication (a real estate site)and I have this problem: I did a serch form with more fields and drop-down fields. I have these drpo-down fields: City:_______ Street:__________ and I want: when I select a city the "Street" drop down to be completed with the streets from the selected city. Can I do this without submiting everything in the other fields? I was thinking to create a method that search in a database all the streets from a selected city, that return an array, and when a city is selected to invoke it and complete the values for the Streets, but I don't know were to put it in the aplication.I am trying to work with Struts. Please give me   More>>

I'am trying to create a web aplication (a real estate site)and I have this problem:
I did a serch form with more fields and drop-down fields.
I have these drpo-down fields:
City:_______ Street:__________
and I want: when I select a city the "Street" drop down to be completed with the streets from the selected city.
Can I do this without submiting everything in the other fields?


I was thinking to create a method that search in a database all the streets from a selected city, that return an array, and when a city is selected to invoke it and complete the values for the Streets, but I don't know were to put it in the aplication.I am trying to work with Struts.


Please give me an advice!
Thank you!
PS: Excuse my english!I am forreign!:)

   <<Less

Re: And I need to know how can i update a drop-down field based on a selection made in another drop down field

Posted By:   Antti_Ropponen  
Posted On:   Thursday, September 8, 2005 07:18 AM

I have the same problem in a way. I have three drop dows and the second is populated according to the first and the third according to the second. The thing work fine with javascript but the problem is that I need to localize those values (in English, French, German, Finnish, Sweden) and I'd like to use struts, is it possible? Anyone could show me some solutions or tips?

Sorry for my uncorrect English.

Re: And I need to know how can i update a drop-down field based on a selection made in another drop down field

Posted By:   Anonymous  
Posted On:   Saturday, July 2, 2005 07:40 AM

Just Right Click and View Sorce on the following links:

http://securecmm.com/minisites/secureparking/reg_prefs.asp

OR

http://www.bestwebatlanta.com/resources/javascripts/dropdown_box_population_smart.htm

Thanks,
Ravish Malhotra.
ravishm@safaltek.com
+919872071911

Re: And I need to know how can i update a drop-down field based on a selection made in another drop down field

Posted By:   Dennis_McKnight  
Posted On:   Thursday, June 16, 2005 03:00 PM

i had to do something like this once. the easiest way would be to have the form submit and refresh once a city is selected, but if you are trying to avoid that you can use what i did.



what you can do is create an ArrayList which holds all the cityCd;street elements... like so

PHL;Walnut

PHL;Chestnut

PHL;Spruce

PHX;Prospect

PHX;Main

....



and so on, where the code before the ';' is the city code used in your dropdown and the text after the ';' is the street name. insert all combinations into your ArrayList and forward it in the request to your jsp.



in the jsp i write a javascript function & array based on those values. here is some sample code ( you need to pass your 2 form objects to it).







not the cleanest way to do it, but it works without refreshing the page. hopefully this code is enough to get you started.... good luck.

Re: And I need to know how can i update a drop-down field based on a selection made in another drop down field

Posted By:   suc_Jag  
Posted On:   Thursday, June 16, 2005 02:24 PM

hi

i have almost similar requirement.. once user selects one item from the selection box ...i have to populate related data in the textboxes below it... i did that as follows

In the action form there is selection box and below text boxes which need to be populated according to the selection

In the selection box there is one property "onchange"..
set this propetry to call an action class.. in that action class you can take the selected value and query database using that value..
Then set the other fields of the action form with the resultset data.... for this to achieve the action form should be is session scope.



I hope it will work.for you.. if you need futher clarification..let me know i will give elaborated description



good luck
About | Sitemap | Contact