Hi,
I´m using form_remote_tag to submit a query, but the flash messages
returned from the controller is lost somewhere. loading.gif is
displayed as it should be. What am I doing wrong? :)
Should form_remote_tag update the div field with the flash-messages?
view.rhtml:
<html>
<body>
<%= display_standard_flashes %>
<p style="color: green"><%= flash[:notice]
%></p>
<p style="color: green"><%= flash[:warning]
%></p>
<%= yield :layout %>
</body>
</html>
_talk.rhtml:
<h1>Send messages</h1>
<p style="color: green"><%= flash[:notice] %></p>
<p style="color: red"><%= flash[:warning] %></p>
<%= content_tag("div", flash[:notice], :id =>
"notice", :class =>
"flash") %>
<% form_remote_tag(:url => {:action => ''tell_me},
:before => "Element.show(''spinner'');",
:success => "show_results(xhr);",
:failure => "show_error(xhr);",
:complete => "Element.hide(''spinner'');") do
%>
<%= display_standard_flashes %>
application_helper.rb:
module ApplicationHelper
def display_standard_flashes
html= ""
html = "I can see this is the view!"
if flash[:notice]
html << content_tag("div", flash[:notice], :id =>
"notice", :class => "flash")
html << javascript_tag( visual_effect(:highlight,
''notice'') )
end
if flash[:warning]
html << content_tag("div", flash[:warning], :id =>
"warning", :class => "flash")
html << javascript_tag( visual_effect(:highlight,
''warning'') )
end
if flash[:error]
html << content_tag("div", flash[:error], :id =>
"error", :class => "flash")
html << javascript_tag( visual_effect(:highlight,
''error'') )
end
html
end
end
--
Regards,
Martin Stabenfeldt
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---