hi all, now i am stuggling to pass the edit id to the ajax edit link. please kindly help me to pass the id. here i have put my coding below. company.rhtml file <% for company in @Edia_comp_addr %> <tr> <td><%= company.street_addr%></td> <td><%=company.city%></td> <td><%=company.state%></td> <td><%=company.pin%></td> <td width=10%><%=company.branch%></td> <td width=10%> <%= link_to_remote "EDIT", :update => ''detail'', :with => "''addr='' + escape($F(''company.id'')) " , :url => { :action => ''edit_comp_addr'' } %> </td> </tr> <% end %> company.rb def edit_comp_addr @tmp=params[:addr] render :text => @tmp end please help me asap -- Posted via http://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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Blake Miller
2007-Mar-07 07:34 UTC
Re: Edit link id is not passing while doing ajax edit link.
Guest, :with=>"''addr='' + escape($F(''company.id'')) " Keep in mind that this string you are passing is entirely JavaScript. company.id is a ruby expression, and only confuses your poor JS interpreter which knows nothing of ruby. Try this: :with=>"''company_id=''+#{company.id}" Then ruby will insert the value of company.id as a string, which gets passed to JS, serialized with the form, becomes part of the AJAX request, etc. The value of company.id should arrive at the action as params[:company_id]. <rant> Again we run into the same paradox: IE is the worst environment in which to try to debug JS (seriously, you''d be better off debugging JS at a rave, or underwater, or in a dark closet . . . its making me queasy just thinking about it), and yet there are tons of quirky, subtle IE-specific JS problems lurking out there. IE is bad! </rant> Cheers, Blake Miller --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
hi, Thanks a lot. i got the answer. Blake Miller wrote:> Guest, > > :with=>"''addr='' + escape($F(''company.id'')) " > > Keep in mind that this string you are passing is entirely JavaScript. > company.id is a ruby expression, and only confuses your poor JS > interpreter which knows nothing of ruby. > > Try this: > > :with=>"''company_id=''+#{company.id}" > > Then ruby will insert the value of company.id as a string, which gets > passed to JS, serialized with the form, becomes part of the AJAX > request, etc. The value of company.id should arrive at the action as > params[:company_id]. > > <rant> > Again we run into the same paradox: IE is the worst environment in > which to try to debug JS (seriously, you''d be better off debugging JS > at a rave, or underwater, or in a dark closet . . . its making me > queasy just thinking about it), and yet there are tons of quirky, > subtle IE-specific JS problems lurking out there. IE is bad! > </rant> > > Cheers, > Blake Miller-- Posted via http://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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---