Replace HTML Problem

M

Mke Van houten

I am using the in_place_editor_field method with scriptaculous and I am
receiving the rjs code instead of the value that was just updated.

The following is the code snippet from my view:

<%= in_place_editor_field('rotational_assignment_applicant',
'placement_priority', {:id =>
"in_place_editor_#{rotational_assignment_applicant.id}"}, :script=>true)
%>

The following is the code snippet from my controller:

def set_rotational_assignment_applicant_placement_priority
@rotational_assignment_applicant =
RotationalAssignmentApplicant.find_by_id(params[:id])
@old_value = @rotational_assignment_applicant.placement_priority
@rotational_assignment_applicant.placement_priority = params[:value]
@rotational_assignment_applicant.placement_priority = @old_value
unless @rotational_assignment_applicant.save

render :update do |page|
page.replace_html
"in_place_editor_#{@rotational_assignment_applicant.id}",
@rotational_assignment_applicant.placement_priority
end
end


The placement_prioirty value is updated in the database correctly, but I
receive the following html code in the placement_priority text field:

ry { Element.update("in_place_editor_62", "3"); } catch (e) { alert('RJS
error:\n\n' + e.toString());
alert('Element.update(\"in_place_editor_62\", \"3\");'); throw e }


Any ideas what might be causing this issue? Thank you in advance for
all your help.
 
R

Roger Pack

I am using the in_place_editor_field method with scriptaculous and I am
receiving the rjs code instead of the value that was just updated.
render :update do |page|
page.replace_html
"in_place_editor_#{@rotational_assignment_applicant.id}",
@rotational_assignment_applicant.placement_priority
end
end

Not quite sure [might want to ask in rails group] but my first suspect
would be that replace_html call--what does it do, etc.
-=r
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,184
Messages
2,570,973
Members
47,530
Latest member
jameswilliam1

Latest Threads

Top