<%- if @customer.id.present? -%>
  <strong><%= link_to @customer.name, @customer %></strong>
<%- else -%>
  <%= autocomplete_field_tag 'customer_name', '', autocomplete_customers_path, 
      :size => 30, 
      :update_elements => {
        :id              => '#trip_customer_id,#trip_customer_attributes_id',
        :phone_number_1  => '#trip_customer_attributes_phone_number_1', 
        :phone_number_2  => '#alt_phone',
        :mobility_notes  => '#mobility_notes',
        :mobility_id     => '#trip_mobility_id',
        :private_notes   => '#customer_private_notes',
        :group           => '#trip_group',
        :address_id      => "#trip_pickup_address_id",
        :address         => "#pickup_search_address"
      } %>
      
  <input type="button" name="new_customer" value="New Customer" id="new_customer" data-path="<%= new_customer_path %>">
<%- end -%>

<%- if @customer.id.present? -%>
  <div id="trip_customer_name_wrapper">
    <strong id="trip_customer_name_string"><%= link_to @customer.name, @customer %></strong>
    &nbsp;&nbsp;&nbsp;&nbsp;(<a href="#" id="change_trip_customer_link">Change Customer</a>)
  </div>
<% end %>
<%= autocomplete_field_tag 'customer_name', @customer.try(:name), autocomplete_customers_path, 
    :size => 30, 
    :update_elements => {
      :id              => '#trip_customer_id,#trip_customer_attributes_id',
      :phone_number_1  => '#trip_customer_attributes_phone_number_1', 
      :phone_number_2  => '#alt_phone',
      :mobility_notes  => '#mobility_notes',
      :mobility_id     => '#trip_mobility_id',
      :private_notes   => '#customer_private_notes',
      :group           => '#trip_group',
      :address_id      => "#trip_pickup_address_id",
      :address         => "#pickup_search_address"
    },
    :style => @customer.id.present? ? 'display: none' : ''
%>
<%- if !@customer.id.present? -%>
  <input type="button" name="new_customer" value="New Customer" id="new_customer" data-path="<%= new_customer_path %>">
<%- end -%>
<%= javascript_tag do %>
  $('#change_trip_customer_link').click(function(event){
    event.preventDefault();
    $('#trip_customer_name_wrapper').hide();
    $('#customer_name').show();
  });
<% end %>
Add the ability to change the customer for an existing trip record
Add the ability to change the customer for an existing trip record
