Thanks so much for the help again : ) I solved it right now with
form_remote_tag, I was playing with it when I was waiting your answer.
Your code helped me alot to understand the process. Here is the code
working.

 <% form_remote_tag(:url => { :controller =>'customer/orders', :action
=> 'change_sale_item_status' },
                                         :html => {:id => 'change_status'}) do 
%>
        <%= hidden_field(:change_status, :id, :value => sale_item.id) %>
        <%= select :change_status, :status_id, @statuscodes.map{|u|
[u.name,u.id]}, { },
                                                  {:onchange => 
"$('change_status').submit()"}%>
<% end %>


  def change_sale_item_status

          # If variations are present we get that as the ID instead...
          sale_item = OrderLineItem.find(params[:change_status][:id])
                sale_item.order_line_item_status_code_id = 
params[:change_status]
[:status_id]
                sale_item.save
                logger.info "Product added...success"
    redirect_to :action => 'list'

  end


On Feb 5, 9:56 pm, Sharagoz -- <li...@ruby-forum.com> wrote:
> > I made it work but without the id params which I need to find the
> > OrderLineItem.
>
> My bad, forgot to include that parameter.
> <%= select_tag(:sale_item,
> options_from_collection_for_select(@statuscodes, :id, :name), :onchange
> => remote_function(:update => 'repair_shop_selection', :url =>
> {:controller =>'customer/orders', :action => 'change_sale_item_status',
> :id => sale_item.id},
> :with => "'brand_id=' + this.value") ) %>
>
> > Also about rendering new objects, in my view, the table view would
> > rearrange after selection, I am listing shipped items on other table.
> > Is it possible? Or Should I figure out how to refresh the page?
>
> I dont know how much content is on the page, and how much of it has to
> be updated. If most of it changes you can refresh it all, if not, just
> replace the small bits that need updating and leave the rest alone.
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to