2 comboboxes

Hello, I have a 2 comboboxes on my web-page. first contains list of
cities, and other contains list of companies. But i need to filter
second combobox by selected city in first combo.
What the best way to implement this.
I know this is not hard task but i don’t what to invent wheel.

Thanks

I made a selection helper… I know, it’s ugly code so the others need
not comment :stuck_out_tongue:

In my case it was States and Cities though. If you take some time to
understand the code you’ll be able to use it as well.

Please see the following in order:
1)

2) Parked at Loopia

In the pastie, you’ll see

  1. state selection box in view → this would be your “city”
  2. encodeURI_selection helper → just a helper that it uses
  3. show_cities.rjs → this would be your “show_companies.rjs” action
  4. city_select.rhtml → this would be your “company_select.rjs”

Remember – your city is to my state, your company is to my city… so
don’t get confused :slight_smile:

On 10/7/07, Igor K. [email protected] wrote:

Hello, I have a 2 comboboxes on my web-page. first contains list of
cities, and other contains list of companies. But i need to filter
second combobox by selected city in first combo.
What the best way to implement this.
I know this is not hard task but i don’t what to invent wheel.

Thanks

Posted via http://www.ruby-forum.com/.


Ramon T.

Thanks Ramon, I’ll check it!