This is what I had and it doesn't work.
<%= radio_button_tag 'ship_method', 'pickup', :checked => true -%> PickupThis is what I ended up with
<%= radio_button_tag 'ship_method', 'deliver' -%> Deliver
<%= observe_field 'ship_method_pickup',
:url => { :controller => 'checkout', :action => 'ship_method_select' },
:on => 'click', :with => 'method' -%>
<%= observe_field 'ship_method_deliver',
:url => { :controller => 'checkout', :action => 'ship_method_select' },
:on => 'click', :with => 'method' -%>
<input type="radio" name='ship_method' id='ship_method_pickup'
checked="checked" value="pickup"
onclick="<%=
remote_function(
:url => {:controller => 'checkout', :action => 'ship_method_select', :method => 'pickup'}
)-%>" />
7 comments:
I had this problem too! I've noticed that there are a few of these mysterious problems in rails... have you submitted it as a bug?
I didn't post a bug report for this issue.
Conrad,
instead of using observe_field you can use this:
<%= radio_button_tag "search_type", "date_range", true, :onclick => showDateRangeOptions %>
And then define showDateRangeOptions like this:
<% showDateRangeOptions = ""
showDateRangeOptions += "$(\'dateRangeOptions\').style.display = \'block\';\n" %>
Thanks for the tip Rocky. I will give that a try.
Thank you very much for your post.
After spending hours trying to get the observe_field to work I came across you post that saved my day.
Thanks again.
Thank you very much for your post. I spent time with this.
You actually don't need to reference another variable, you can do it inline (the important part is to escape the single quotes):
<%= radio_button_tag "search_type", "date_range", true, :onclick => "$(\'dateRangeOptions\').style.display = \'block\';" %>
Post a Comment