# Replace HTML Problem

**URL:** <https://www.ruby-forum.com/t/replace-html-problem/157126>\
**Category:** Ruby\
**Created:** [January 7, 2009, 4:18pm UTC](https://www.ruby-forum.com/t/replace-html-problem/157126 "2009-01-07T16:18:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mvanhouten](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@mvanhouten](https://www.ruby-forum.com/u/mvanhouten)\
**Post date:** [January 7, 2009, 4:18pm UTC](https://www.ruby-forum.com/t/replace-html-problem/157126/1 "2009-01-07T16:18:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mvanhouten](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@mvanhouten](https://www.ruby-forum.com/u/mvanhouten)\
**Post date:** [January 8, 2009, 7:37am UTC](https://www.ruby-forum.com/t/replace-html-problem/157126/2 "2009-01-08T07:37:11Z")

</div>

> 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
