html rendering is done this way : ( sorry... haml code..) = form_for(resource, :as => resource_name, :url => user_registration_path(I18n.locale) ) do |f| = render "shared/error_messages", :target => [resource] and the shared/error_messages partial is quite standard ( made visible or not... if no errors...) #resource_error_messages{:style => "display:#{errorsInForms(target) > 0 ? ''visible'' : ''none''}"} #error_explanation - target.each do |field| - if field.errors.any? %ul - field.errors.full_messages.each do |msg| %li= msg.html_safe unless msg.nil? this runs very well .... but I need to output it with a js request ( render :action => ''create.js'' ) in my create.js.erb , I wrote : $(''#resource_error_explanation'').html("<%= escape_javascript( render ''shared/error_messages'', :target => [resource] ) -%>"); to render the errors, then I show the div $(''#resource_error_messages'').show(); but the errors are NOT rendered at all.... what should I write instead ?? thanks for your feedback -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You forgot to post you controller code, that the most important part -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I finally solved this issue ...passing the locals ... $(''#resource_error_explanation'').html("<%= escape_javascript( render ''shared/error_messages'', :target => [resource] ) -%>"); is not valid ... in the controller I have now @target = [resource] and I am passing :locals => {:target => @target} I modified also the partial to use target and that''s it... it tooks time to switch my mind to non-obstrusive js , but I understand it better and of course I appreciate it On Jun 2, 8:03 pm, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You forgot to post you controller code, that the most important part-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.