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: <td> <span id="<%= "#{dom_id(track)}_title" %>"><%= track.title %></span> </br> <% if @edit %> <span id="<%= "#{dom_id(track)}_title_edit"%>" class="small_edit">edit</span> <%= 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 %> </td> ------------------- 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!!'' -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Kovacs
2007-Apr-28 23:18 UTC
Re: in_place_edit ends up with try catch block as content?
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 On Apr 28, 2007, at 2:58 PM, Adam wrote:> > 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: > <td> > <span id="<%= "#{dom_id(track)}_title" %>"><%= track.title %></ > span> > </br> > <% if @edit %> > <span id="<%= "#{dom_id(track)}_title_edit"%>" > class="small_edit">edit</span> > <%= 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 %> > </td> > > ------------------- > 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!!'' > > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Kovacs 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.comThanks for the reply. The default method called from an in_place_edit field is set_track_<attribute name> 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=''??? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---