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:
<%= display_standard_flashes %><p style="color: green"><%= flash[:notice] %></p>
<p style="color: green"><%= flash[:warning] %></p>
<%= yield :layout %>
_talk.rhtml:
Send messages
<%= flash[:notice] %>
<%= flash[:warning] %>
<%= 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 S.