RJS Problem..Now Whats incrorect here

I am trying to Update a field on my search result page through
in_place_edit and then render a partial to display the updated contents.
I am receving the following instead of the real value which is “John
Wright”

try { Element.update(“first_name”, "\n \u003Cspan
class=“in_place_editor_field”
id=“copy_first_name_10115_in_place_editor”\u003EJohn
Wright\u003C/span\u003E\u003Cscript type=“text/javascript”\

P.S. If i refresh the page manually i get the correct Values as updated
on the page.

Following is my the code for the 4 files required to implement

  1. The list of search results (view)
  2. The controller contating the definition updateattribute
  3. The updateattribute.rjs
  4. _first_name.html.erb partial

part of view showing search results

<%if params[:first_name]=“1”%>

<%end%>

.
.
.

<%end%>
<%unless
person.first_name.blank?%>
<%[email protected] = person; in_place_editor_field :copyofperson,
:first_name, {}, :url => { :controller => ‘person’, :action =>
‘updateattribute’, :id => person.id } %>
<%end%>

#person controller
def updateattribute
@person = Person.find(params[:id])
i = params[:editorId]
j = i.split("")
j.pop
j.pop
j.pop
j.pop
j.delete_at(0)
field_name = j.join("
")#Getting the field to be updated in field_name

@person.update_attribute “#{field_name}”, “#{params[:value]}”

end

updateattribute.rjs

page.replace_html ‘first_name’, :partial=>‘first_name’, :object=>@person

_first_name.html.erb

<%[email protected] = @person; in_place_editor_field :copyofperson, :first_name, {}, :url => { :controller => 'person', :action => 'updateattribute', :id => @person.id } %>

On 17 Jul 2008, at 14:56, Ank Ag wrote:

Wright\u003C/span\u003E\u003Cscript type=“text/javascript”\

If I remember correctly, the in place editor is expecting you to
return an html fragment it can stick in the DOM, whereas you’re
sticking in some JS.
There may be some options for customizing that, but I can’t remember
off the top of my head.

Fred

Frederick C. wrote:

On 17 Jul 2008, at 14:56, Ank Ag wrote:

Wright\u003C/span\u003E\u003Cscript type=“text/javascript”\

If I remember correctly, the in place editor is expecting you to
return an html fragment it can stick in the DOM, whereas you’re
sticking in some JS.
There may be some options for customizing that, but I can’t remember
off the top of my head.

Fred

Could you please tell me what should i look for on the internet. Or any
other alternative to implement in place edit
Thanks

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