#8 ✓invalid

javascript not eval'ed properly for "Ajax.InPlaceEditor"

Reported by Greg | April 14th, 2008 @ 01:17 PM


Reference the following mailing list link that discussed this but for which there was no identified solution: http://groups.google.com/group/r...

I have a basic Ruby on Rails test application for which I have:

-----------view snippet--------------

<%= in_place_editor_field "e", 'body', {:id => "bodyfield" }, {} %>

----------this produced the following if going View Source --------



new Ajax.InPlaceEditor('bodyfield', '/testcontroller/set_e_body/6')

----------controller snippet-----------

def set_e_body

render :update do |page|

page.replace_html 'bodyfield', "it updated"



Now, the initial screen is rendered fine, however after I click in the field and then click on OK:

a) response goes to server OK

b) server returns response OK

c) no Javascript errors occur but

d) what is rendered is per the below

====this is rendered========

try { Element.update("bodyfield", "it updated"); } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('Element.update(\"bodyfield\", \"it updated\");'); throw e }

So, it is if the javascript wasn't been correctly eval'ed. I will post some additional information below re the ajax request/response from firebug:


Response Headers

Connection close

Date Mon, 14 Apr 2008 11:11:50 GMT

Status 200 OK

X-Runtime 0.00553

Etag "6bc01a7877c5961f22060ce05c109164"

Cache-Control private, max-age=0, must-revalidate

Server Mongrel 1.1.4

Content-Type text/javascript; charset=utf-8

Content-Length 169

Request Headers


User-Agent Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv: Gecko/20080311 Firefox/

Accept text/javascript, text/html, application/xml, text/xml, */*

Accept-Language en-us,en;q=0.5

Accept-Encoding gzip,deflate

Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive 300

Connection keep-alive

X-Requested-With XMLHttpRequest


Content-Type application/x-www-form-urlencoded; charset=UTF-8


Content-Length 40

Cookie _test_rails2_session=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo%250ASGFzaHsABjoKQHVzZWR7AA%253D%253D--bcec9a5dfe6dee5b75bc70ce552a8aba2f824553

Pragma no-cache

Cache-Control no-cache


try {

Element.update("bodyfield", "it updated");

} catch (e) { alert('RJS error:\n\n' + e.toString()); alert('Element.update(\"bodyfield\", \"it updated

\");'); throw e }


[1] I'm using versions: Background: I'm running Mac OSX 10.5.2. Ruby 1.8.6. Rails 2.0.2.

ActiveScaffold 1.1.1.

[2] As Rails 2.0 doesn't have in_place_editing as this is now a plugin. I have this installed so this "in_place_editing" plugin provides the functions such as the "in_place_editor_field" function used in the VIEW.


Comments and changes to this ticket

  • Andrew Dupont

    Andrew Dupont April 14th, 2008 @ 06:04 PM

    • State changed from “new” to “invalid”

    This is an issue with script.aculo.us, not with Prototype. Can you re-file this in the script.aculo.us project? Thanks!

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket