不在同一行的单选按钮值
我正在构建一个“自助餐菜单列表”表单,其中有很多“菜单”单选按钮选项。 但是我注意到所有这些值都是“内联”的,就像本例中一样: http:// demo.atk4.com/demo.html?t=14
我想知道,首先如何在每个值上添加换行符,然后,如何通过添加某种类型来模拟组< p> < /p>特定选项值之间(逻辑分组)。
提前致谢!
I'm building a "buffet menu list" form which has a lot of options for the "menu" radiobutton.
However I noted that all those values are "inline" just like in this example: http://demo.atk4.com/demo.html?t=14
I'd like to know in first instance how could I add a line break on every value, and then, how could I simulate groups by adding some sort of < p> < /p> between specific option values (logical grouping).
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我能想到的解决方案有两种。
查看此处的示例以获得一些灵感:
http://agiletoolkit.org/doc/grid/columns
1. 将自定义字段添加到网格中
首先,创建一个没有标记的表单:
接下来,将网格添加到如下所示的表单中:
添加用于选择的列:
最后 - 确保列“选择”是第一个(或最后一个)
最后需要手动查看POST 数据,因为它不是真正的表单列。
您必须记住,直接访问 POST 会使您面临注入攻击,并且您必须正确验证它。网格也必须位于表单内,但是您可以将提交按钮放置在页面上的任何其他位置。您还可以使用“Form_Plain”,请参阅“http://agiletoolkit.org/whatsnew”的示例。
2. 使用 JavaScript 和隐藏字段
在此示例中,您可以添加一堆单选按钮元素并将它们绑定到表单。我还在这里使用“Lister”而不是“Grid”,当然您可以混合搭配这些方法。
您的 view/menu.html 模板文件可能如下所示:
编辑:适用于 Fernando 的代码
There are two solutions I can think of.
Look at the examples here for some inspiration:
http://agiletoolkit.org/doc/grid/columns
1. Adding custom field to grid
First, create a form with no mark-up:
Next, add Grid into a form like this:
Add a column for selection:
Finally - make sure the column 'selection' is first (or last)
Finally you need to manually look into the POST data, because it's not a real form column.
You must remember that accessing POST directly exposes you to injection attack and you must validate it properly. Grid also MUST be inside the form, however you can place submit button anywhere else on your page. You can also use "Form_Plain", see "http://agiletoolkit.org/whatsnew" for an example.
2. Using JavaScript and hidden field
In this example you can add a bunch of Radio button elements and tie them to a form. I've also using "Lister" here instead of "Grid", of course you can mix-and-match those approaches.
Your view/menu.html template file could look like this:
EDIT: code which worked for Fernando