Folks,
I have an app that collects customer info and asks the user to click a
checkbox if he has a billing address that’s different from his shipping
info. There’s an event listener that detects the checkbox click and
renders a partial with the billing address info. Works great. Except
that the billing address stuff is not being dumped into params and is
therefore not being saved in the model.
I have another app with this same functionality that works perfectly…
no idea what’s gone wrong here. suggestions?
main view
<%= form_tag(:action => ‘save_customer’) %>
<%= javascript_include_tag ‘prototype’ %>
Please enter your details below
<%= text_field("customer", "name", "size" => 40 ) %>
<%= text_field("customer", "email", "size" => 40 ) %>
Your shipping address
<%= text_field(“customer”, “ship_address1”, “size” => 40 ) %>
<%= text_field("customer", "ship_address2", "size" => 40 ) %>
<%= text_field("customer", "ship_city", "size" => 40 ) %>
<%= options = [["Select a state", ""]] + Customer::STATE_NAMES select("customer", "ship_state", options) %>
<%= text_field("customer", "ship_zip", "size" => 10 ) %>
<%= options = [["Select a country", ""]] + Customer::COUNTRY_NAMES select("customer", "ship_country", options) %>
<%= check_box_tag(“different_bill”) %>
<%= observe_field(:different_bill, :update => “billinfo”, :url => {
:controller=>‘shirts’, :action => ‘billing_address’ }, :with =>
“‘id=’+value” ) %>
Credit CardPaypal
<%= submit_tag "Save" %>
partial
Your billing address
<%= text_field(“customer”, “bill_address1”, “size” => 40 ) %>
<%= text_field("customer", "bill_address2", "size" => 40 ) %>
<%= text_field("customer", "bill_city", "size" => 40 ) %>
<%= options = [["Select a state", ""]] + Customer::STATE_NAMES select("customer", "bill_state", options) %>
<%= text_field("customer", "bill_zip", "size" => 10 ) %>
<%= options = [["Select a country", ""]] + Customer::COUNTRY_NAMES select("customer", "bill_country", options) %>
controller action
def billing_address
if params[:id] == "1"
render :partial => 'billinfo', :layout => false
else
render :nothing=>true
end
end