Auto refreshing a page based on select change

Hi all,

I have a select helper form on a web page which contains a list of
dates. When
the user selects a date, one of the other forms on the page needs to be
updated
based on the newly selected date.

Is there a way to catch this event in Rails? Are we talking Ajax here?
Or is
there a simpler way?

Thanks,

Dan

Daniel B. wrote:

Hi all,

I have a select helper form on a web page which contains a list of
dates. When
the user selects a date, one of the other forms on the page needs to be
updated
based on the newly selected date.

Is there a way to catch this event in Rails? Are we talking Ajax here?
Or is
there a simpler way?

Thanks,

Dan

You could use a ‘onchange()’ script with your select dropdown and
postback a parameter that updates the other field.

Not too difficult, but not as slick as an AJAX solution.

Kevin O. wrote:

Is there a way to catch this event in Rails? Are we talking Ajax here?

Not too difficult, but not as slick as an AJAX solution.

Thanks Kevin, but I’m not sure how that should look exactly.

<%=
select(:var, :attr, choices, :options => {:onchange => })
%>

I’m having trouble following the docs. Please help.

Thanks,

Dan

Take a look at this…

http://www.faqs.org/docs/htmltut/forms/_SELECT_onChange.html

On 1/7/06, Kevin O. [email protected] wrote:

Is there a way to catch this event in Rails? Are we talking Ajax here?
Or is
there a simpler way?

Thanks,

Dan

You could use a ‘onchange()’ script with your select dropdown and
postback a parameter that updates the other field.

Why cant you do Ajax.updater () for the onchange() event? That would be
AJAX
right ?
There is an example at
http://www.roryhansen.ca/?p=9
which uses the observer but I was thinking why not use the onchange
insted
of the observer?

Not too difficult, but not as slick as an AJAX solution.

Thanks Kewin!!

Your link:

HTML onChange - HTML Code Tutorial

helped me solve a problem that’s I’ve been trying to fix since before
christmas. Nice one.