I’m building a form where I have a set of radio buttons. When any of
these are selected I make an AJAX call that needs some values from
other fields in the form, but I’m having problems getting those values
and maybe someone can help.
I have the following code which is essentially repeated for each of
the radio buttons:
<%= radio_button_tag(:recurrence_period,
CalendarRepeatingEvent::RECURRENCE_PERIOD_MONTHLY_BY_DATE,
@recurrence_period ==
CalendarRepeatingEvent::RECURRENCE_PERIOD_MONTHLY_BY_DATE, {:onchange
=> remote_function(:with => “‘recurrence_period=’+this.value
+’&recurrence_frequency=#{@recurrence_frequency}&occurrence_number=#{@occurrence_number}’”,
:url
=> {:action => ‘select_recurrence_period’ })}) %>
Monthly
Note that the 2 values I’m trying to pass back are where I have
@recurrence_frequency and @occurrence_number… these are just
placeholders because they’re really instance variables passed when the
form is initially setup and I just wanted to see if something got
passed back.
elsewhere in the form are the elements (id=‘frequency’ and id=‘count’)
I want to pull values from and pass back… here’s that code:
Every:
Frequency:
<%= text_field_tag(:recurrence_frequency, @recurrence_frequency, :size
=> 2) %>
How many times?
<%= text_field_tag(:occurrence_number, @occurrence_number, :size => 4)
%>
(I hope this code is easy to read as sposted)
I tried using the Prototype utility method $F to pull the values (e.g.
$F(‘frequency’)), but either that doesnt work or I’m doing it wrong.
Anybody familiar with this kind of problem?