:with for observe_field helper--parameter passing

Sam Woodard wrote:

I am trying to write a :with hash for the observe_field helper watching
a select which was built by select_month--it contains all of the months.

The current :with that I have, which works, is:

:with => "month"

,which passes the updated month in the select through params[:month].
However, I need to pass the current year through params[:year], which
does not change when the month select is updated, something like this:

:with => " 'month=' escape($('start_date_month_select').value) +
'&year=' + escape(@current_two_months[0][0].year) "

but this doesn't work.

In other words, I need to pass the changed value of the select through
params[:month] and I need to pass @current_two_months[0][0].year through

How do I do this?


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


It might be easier for you to use a form_observer and have it pass the
entire params (:with=>'value=value').

This will give you access to all parameters.