Rails 复选框和参数
我在页面中使用了许多复选框,如下所示:
<%= check_box_tag(:one, value = 1) %></p>
想象一下,它从 1 到 20,值更改后仍然相同。如何在控制器中获取已检查参数的params
?
示例:如果用户检查 3、5 和 10,我怎样才能在单个参数中获取这些参数?
I am using many checkboxes in a page as the following:
<%= check_box_tag(:one, value = 1) %></p>
Imagine that it goes from 1 to 20, all the same with the value changed. How can I get in the controller the params
of the ones that were checked?
Example: If user checks 3, 5 and 10 how can I get just those params in a single params?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将已经只获得已检查的内容;未选中的框不会发送到服务器。
You'll already get only the ones that were checked; unchecked boxes aren't sent to the server.