I want to have the second select options dependent on the selection of
the first select option. Is this built into Rails? I haven’t seen it.
I’d rather not right JavaScript and Ajax to pull values in background
unless necessary.
Pete
I want to have the second select options dependent on the selection of
the first select option. Is this built into Rails? I haven’t seen it.
I’d rather not right JavaScript and Ajax to pull values in background
unless necessary.
Pete
Hi Peter,
Peter A. wrote:
I want to have the second select options dependent on the
selection of the first select option. Is this built into Rails?
No.
I’d rather not right JavaScript and Ajax to pull values in
background unless necessary.
It’s necessary, but not difficult. You put an observe_field on the
first
select that calls a controller method when the select changes, passing
along
the value selected. The controller method (re)renders the second select
via
rjs, either inline in the method or via a separate rjs view. Search the
list archives. The question’s been asked / answered many, many times.
HTH,
Bill
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs