在 Rails 中构建分页表单,最好的方法是什么?
我有一个 Rails 应用程序,它从申请人那里收集大量信息 - 大部分都是常见信息:姓名、身份证明、地址历史记录、就业详细信息和一些个人参考资料。
目前,该表单是使用 jQuery UI 选项卡将每个部分分解为一个页面(大约 7 页)来实现的。这在过去很有效,但是现在很多用户抱怨它非常慢 - 因为页面太大,以至于每次更改选项卡时浏览器都会阻塞修改 DOM。
我想做的只是渲染该页面所需的表单字段,并且仅在离开页面进入下一个页面时调用这些字段所需的验证。
Rails 中最好的方法是什么?
I have a Rails application which gathers a large amount of information from applicants - mostly just the usual: names, proof of ID, address history, employment details and some personal references.
At the moment the form is implemented using jQuery UI tabs to break down each section into a page (roughly 7 pages). This has worked well in the past, however a lot of users are now complaining that it is very slow - because the pages are simply too big that their browser chokes modifying the DOM every time they change tab.
What I would like to do is only render the form fields required for that page, and only call the validations required for those fields when leaving the page to progress to the next.
What is the best approach to this in Rails?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一个 Railscast :
http://railscasts.com/episodes/217-multistep-forms< /a>
There is a Railscast for that:
http://railscasts.com/episodes/217-multistep-forms