Dynamic Select Box

_Kevin wrote:

Iw wrote:

:state) %>

  • address_controller.rb
    @address = Address.find(params[:id])
    partial _select_cities.rhtml

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

Couple of points.

  1. if you set the frequency of your observer to 0, it should fire off
    whenever the value changes, and not every 0.25 seconds.

  2. check your log files to see if you are getting errors thrown by the
    filtered_city_select method

  3. Don’t use ‘@params’, it’s deprecated.

Does it work at all?

_Kevin

No errors in the log.
Insert works. Data is getting saved in the database. The Edit/Update
screen does not highlight (select) the item in the second drop down -
the city.

Another option is to observe and redraw the entire form, rather than
just field-by-field.

I have my entire form in a partial, and I use RJS to redraw the partial
from an observe_form event - anytime anything changes in the form, the
entire form is redrawn and this accomplishes 2x, 3x, Nx select box
updates.

c.

Ramanan wrote:

I have a working code where there are only 2 select boxes i.e.
populating city when state is selected. I am having issues with
populating locality based on selected city. Working with 2 dynamic
select is straight forward. Working with more than 2 dynamic/cascading
select box is a real issue.

Thx. for your help

On 8/19/06, Ramanan [email protected] wrote:

Thx.
Ramanan


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


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

I did end up with something… You can find it at
http://rails.techno-weenie.net/tip/2006/6/20/cascading_select_boxes_with_rjs_even_on_ie

But this is far from perfect. Kevins has given an alternative solution
as
well, but the one that I’m after I can’t seem to find.

Shortly after I posted the tip on
http://rails.techno-weenie.netTechnoweenie, aka Rick O. posted a
much better solution. Since then
there has been some db issues at rails weenie and I can’t find it.

Rick if you catch this post can you please provide a link to the tip you
posted.

Cheers