Javascript code displayed on replace_html call

Hey all, I am working on some validation for the in_place_editor_field
and I
have a custom handler to catch and preform all of the saving and to
execute
validation. I’m pretty close to being satisifed with the results, but I
have one nagging problem. When I get into the else block of the below
code,
the following is displayed in the in place editor field:

“page.replace_html(“custom_field_name_#{params[:id]}_in_place_editor”, @
category.send(:name))”

Any ideas on why this might happen? My controller code is below.

def set_category_name
@category = Category.find(params[:id])
previous_name = @category.name
@category.name = params[:value]

if @category.save
    render :text => @category.name
else
    render :update do |page|
        page.alert("Category name must not be blank.")
        page.replace_html("custom_field_name_#{params[:id]}_in_place_editor",

previous_name)
end

end

end


Ryan P.
[email protected]

Make sure you’re calling in_place_editor_field with options[:script]
set to true. It defaults to false, and the only way the field knows to
evaluate JavaScript in the return call is by setting this value. Your
call should look something like this:

<%= in_place_editor_field(:category, :name, {}, :script => true %>