In_place_edit ends up with try catch block as content?

I have a few in place edit fields in a table. but when i enter a null
value it now, promts me with the alert. ~BUT then enters the returned
rjs into the editable field: ~??

try {ry { alert(“not working”); } catch (e) { alert(‘RJS error:\n\n’ +
e.toString()); alert(‘alert(“not working”);’); throw e }


rhtml:

"><%= track.title %> <% if @edit %> " class="small_edit">edit <%= in_place_editor "#{dom_id(track)}_title", {:url => url_for(:action => "set_track_title", :id=> track), :class => 'editor', :external_control => "#{dom_id(track)}_title_edit"} %> <% end %>

Which call this method:

def set_track_title
@track = Track.find(params[:id])
@track.title = params[:value]
@message = “\n Title #{@track.errors[‘title’]}” unless @track.save

render :action => 'update_track.rjs'

end

=-----------------
Which calls this rjs template

page.alert ‘why wont you work…damn you rjs error!!’

Most times whenever you see javascript being displayed from your rjs
template it’s
more often than not because you’re also using the :update option on
the AJAX call.
I haven’t looked at what the in place editor creates but I’d be
willing to bet that it’s using
:update by default so if you want to use rjs you’ll have to create
your own action to do
the update.

Hope that helps,

-Michael
http://javathehutt.blogspot.com

Michael K. wrote:

Most times whenever you see javascript being displayed from your rjs
template it’s
more often than not because you’re also using the :update option on
the AJAX call.
I haven’t looked at what the in place editor creates but I’d be
willing to bet that it’s using
:update by default so if you want to use rjs you’ll have to create
your own action to do
the update.

Hope that helps,

-Michael
http://javathehutt.blogspot.com

Thanks for the reply.

The default method called from an in_place_edit field is

set_track_

So in my case its: set_track_title. I have added a few puts in there to
check that it get the params[:id] value and it seems to be fine.

One thing to note, while the logs and above puts suggest that i am
sending and receiving the params[:id]. When i view the action in firebug
the posted value is ‘value=’???

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs