开发者

How to combine formtastic with Ajax form submission?

开发者 https://www.devze.com 2022-12-28 18:17 出处:网络
I would like to use formtastic instead of standard Rails 开发者_开发知识库helpers for my forms, however I currently submit them using Ajax (with remote_form_for). I suppose I could use the jQuery form

I would like to use formtastic instead of standard Rails 开发者_开发知识库helpers for my forms, however I currently submit them using Ajax (with remote_form_for). I suppose I could use the jQuery form plugin to Ajax-ify formtastic forms, but would it be the best approach?


Yes, if you get your form working great without Ajax, then apply the extra functionality unobtrusively with Javascript, you'll have the best of both worlds. The remote_form_for option is removed or deprecated from Rails 3, but they have added a form_for ... :remote => true option which Formtastic will support when we merge in Rails 3 support (planned for 1.1).


If you need add and remove fields (nested forms or attributes) functionality for you models — use cocoon gem with formtastic

0

精彩评论

暂无评论...
验证码 换一张
取 消