www.ajaxscaffold.com has an interesting solution.
they have a <div id="messages">...</div> that is usually hidden. this allows you from the server to do stuff like this.
Code:
def open_version_detail
begin
@brief = Brief.find_version params[:id], params[:version]
@successful = true
rescue
flash[:error], @successful = $!.to_s, false
end
end
and in the open_version_detail.rjs
Code:
@options = { :scaffold_id => params[:scaffold_id], :action => "version_detail", :id => params[:id], :version => params[:version] }
@view_options = @options.merge(:action => "view")
if @successful
page.hide element_row_id(@view_options)
page.insert_html :bottom, scaffold_tbody_id(@options), :partial => 'view_detail', :locals => { :hidden => true }
page << "new TableRow.MoveAfter('#{element_row_id(@view_options)}', '#{element_row_id(@options)}');"
page.show element_row_id(@options)
else
page.replace_html scaffold_messages_id(@options), :partial => 'messages'
end
page.hide loading_indicator_id(@view_options)
the messages partial will handles the rest. red for error, purple and blue for the other 2
Bookmarks