有没有办法禁用默认格式布局?
对于一种特定情况,我想将表单呈现为(用于就地编辑)的一部分。有没有一种方法可以禁用 .inputs / .buttons 生成的布局?相反,
<fieldset> <ol> <li>
我只想将字段包装在“
<td>
是否有内置方法或解决此问题的方法?”中。
For one specific case I would like to render the form as a part of (for in-place editing). Is there a way in formtastic to disable the layout generated by .inputs / .buttons? Instead a
<fieldset> <ol> <li>
i would like simply to wrap the fields in the
<td>
Is there a build-in way or any solution to this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Formtastic 中还没有内置方法来更改标记。要么使用 CSS 来调整充足的标记钩子,要么放弃 Formtastic 以使用此表单并以您自己的方式进行编码(就像我们以前那样)。
There's no built in way (yet) in Formtastic to change the mark-up. Either use CSS to tweak the ample mark-up hooks in place, or ditch Formtastic for this form and code your own way (like we used to).
尚不支持,但是您可以使用分叉的 formattastic 版本:
https://github.com/linoj/formtastic
更多详细信息,请访问:
http://www.vaporbase.com/postings/Replaceable_render_engines_for_Formtastic
在 formattastic 论坛上阅读,它可能有一天甚至会合并到原点。
It's not yet supported, however you can use forked formtastic version:
https://github.com/linoj/formtastic
More details at:
http://www.vaporbase.com/postings/Replaceable_render_engines_for_Formtastic
Read on the formtastic forum that it might be even merge to origin someday.
在 Rails 中,您可以覆盖定义用于渲染元素的标签的函数:
config/initializers/formtastic_foundation.rb:
我使用此代码将 Formtastic 3 与 Foundation 5.4.5 集成
In rails you can overrite the functions that define the tags that are used to render elements:
config/initializers/formtastic_foundation.rb:
I use this code to integrate Formtastic 3 with Foundation 5.4.5
我将对 formattastic 位(在我的 haml 文件中)的调用包装在一个字符串中,然后将其替换掉
这可能比在没有 formattastic 的情况下重写表单要容易一些,而且效果很好。
诚然,这不是一个理想的解决方案。不过,暂时...我可以忍受。
I wrapped my call to the formtastic bit (in my haml file) in a string and then subbed out the
It's a might bit easier than re-writing the form without formtastic, and it worked perfectly.
Admittedly it's a not an ideal solution. For a one off though... I can live with it.