2011-08-25 84 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

回答

相關問題