flash error & fade away

this is my current code:

#notice {
border: solid 1px #99cc99;
background-color: #e2f9e3;
color: #006600;
padding: 5px;
margin-bottom: 5px;
}

#notice.error {
border-color: #e2f9e3;
background-color: #eeaaaa;
color: #cc0000;
}

<% flash.each do |key, msg| %>
<%= content_tag :div, flash[:error] || flash[:notice], :id => ‘notice’, :class => (‘error’ if flash[:error]) %>
<% content_tag :script, :type => “text/javascript” do %>
$(’<%= key %>’).style.display = ‘none’;
new Effect.Appear(’<%= key %>’, {duration: 3});
<% end %>

<% content_tag :script, :type => “text/javascript” do %>
setTimeout(“new Effect.Fade(’<%= key %>’);”, 10000);
<% end %>
<% end %>

but how can i achieve to css the rails standard way of showing errors liek that one:

1 error prohibited this comment from being saved

There were problems with
the following fields:

  • Title can’t be blank

only if i return something like that:
flash[:error] = ‘Error’

it actually shows up in “my” div.

hope u guys know what i mean :wink:

thx

Hey,

Not quite understood – could you explain further?

Thanks,
/Lasse

hi,ok let me try:

i want the standard rails (error)messages like this one:

1 error prohibited this comment from being saved

There were problems with
the following fields:

  • Title can’t be blank

to fade away.
so not sure how to do that…

thx

Ok – you could easily do this by fading the div with id=“errorExplanation”, like this:

$(‘errorExplanation’).fade();

Would this do it?

/Lasse