首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >表单提交后仍保留Flash[:notice]

表单提交后仍保留Flash[:notice]
EN

Stack Overflow用户
提问于 2011-08-25 18:28:13
回答 1查看 503关注 0票数 1

当表单提交时,将显示flash消息,并且用户将保留所有字段的相同页面。如果删除了其中一个必填字段,然后再次提交表单,则不会显示错误,并显示flash: filled.Now is displayed.When I off.unable the page the notice off.unable to找出.i提供视图代码和控制器的原因

代码语言:javascript
复制
flash[:notice] = "Saved Successfully"

查看代码:

代码语言:javascript
复制
   <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 %>

<%结束%>

EN

回答 1

Stack Overflow用户

发布于 2011-08-25 18:35:11

闪光消息仅存在于下一页。如果刷新页面,则闪光消息将不再存储在会话中。

这里有一篇很好的博客文章,可以帮助你理解flash消息。http://travisonrails.com/2008/08/17/working-with-the-flash-hash

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7188782

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档