Forum: Ruby on Rails AJAX and select form help

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Daniel B. (Guest)
on 2006-01-13 21:19
(Received via mailing list)
Hi all,

Trying a different approach here.  I've got a select box on the
_form.rhtml
(for 'new') like so:

<%= select(:schedule, :start_date, @dates) %>

When that date changes, I need it to pass the selected value to the
get_dates
controller function (of the Schedule class), that looks like so:

def get_slots(date)
    @slots = Schedule.get_available_slots(date)
end

Then I need another select box updated on the same (_form.rhtml) page:

<div id="slots">
    <%= select(:schedule, :slot_number, @slots) %>
</div>

This can be in a partial if necessary.

How do I do this with with AJAX?  I've tried following the examples, but
I'm
not doing so well.

Thanks,

Dan
This topic is locked and can not be replied to.