2011-08-25 80 views
1

表单提交后,将显示Flash消息,并且用户保持在所有字段填充的同一页面上。现在,如果其中一个必填字段id被删除,并且我们再次提交表单,没有显示错误和闪光灯[:声明]是displayed.When我刷新页面的通知去off.unable弄清楚。我已经给视图代码和控制器表单提交后仍然存在[:notice]

flash[:notice] = "Saved Successfully" 

查看原因代码:

<b><h3><%= flash[:notice] %></h3></b> 
<% semantic_form_for(@featured_business, {:url => "#{@signin_link}".gsub(/\/+/, '/'), :html => {:multipart => true, :class => 'validate business'}}) do |f| %> 
<% f.inputs do %> 

    <%= hidden_field_tag 'more_validations_required' %> 
    <%= f.input :name, :label => ' Name:' , :input_html => { :style => "width:240px;" }%> 
    <%= f.input :contact_name, :label => 'Contact name:',:required => false, :input_html => { :style => "width:240px;" } %> 
    <%= f.input :phone, :label => 'Phone Number:', :input_html => { :style => "width:240px;" } %> 
    <%= f.input :email, :label => 'Email:', :input_html => { :class => 'email' } , :input_html => { :style => "width:240px;" } %> 


    <%= f.commit_button :label => "", :button_html => {:class => 'signup business'} %> 
<% end %> 

<%end%>

+0

遵循@Gazler的链接,或者一个hacky的解决方案可以是'<%= flash.delete(:notice)%>' – rubish

回答

相关问题