【发布时间】:2012-06-14 15:27:02
【问题描述】:
我将 simple_form 用于表单并传入一些 URL 参数 预填充表单。
这段代码可以正常工作
<%= f.input :first_name, :label => 'First Name', :input_html => { :value => params['first'] } %>
使用网址
http://localhost:3000/charities/new?first=Bob
输出这个 HTML
<input class="string required" id="charity_first_name" name="charity[first_name]" size="50" type="text" value="Bob" />
但是,如果表单服务器端验证失败,页面会重新加载但预填充 价值没了?这是呈现的 HTML
<input class="string required" id="charity_first_name" name="charity[first_name]" size="50" type="text" />
谁能帮助建议如何预填充 simple_form 并保留这些 如果服务器端验证失败并且页面重新加载,则值?
谢谢。
【问题讨论】:
-
与
form_tag相关:stackoverflow.com/questions/4129229/…
标签: simple-form