Edit link id is not passing while doing ajax edit link

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 %>

                               <td><%= company.street_addr%></td>
                               <td><%=company.city%></td>
                               <td><%=company.state%></td>
                               <td><%=company.pin%></td>
                               <td

width=10%><%=company.branch%>


<%= link_to_remote “EDIT”,
:update => ‘detail’,
:with => "‘addr=’ + escape($F(‘company.id’)) " ,
:url => { :action => ‘edit_comp_addr’ }
%>

<% end %>

company.rb

def edit_comp_addr

@tmp=params[:addr]
render :text => @tmp

end

please help me asap

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].

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!

Cheers,
Blake M.

hi,

Thanks a lot. i got the answer.

Blake M. 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].

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!

Cheers,
Blake M.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs