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 Prins
rprins-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
http://www.lazyi.net
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
atraver-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Aug-28 23:55 UTC
Re: Javascript code displayed on replace_html call
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 %>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---