Forum: Ruby Replace HTML Problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mke V. (Guest)
on 2009-01-07 17:18

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.
Roger P. (Guest)
on 2009-01-08 08:37
> 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
This topic is locked and can not be replied to.