简体   繁体   English

创建Zend_Form表格显示,每行都有一个单选按钮的最简单方法是什么?

[英]What's the simplest way to create a Zend_Form tabular display with each row having a radio button?

I've seen simple examples of rendering a Zend_Form using decorators, but I'm not sure they are able to handle the issue I'm facing very well. 我已经看到了使用装饰器渲染Zend_Form的简单示例,但是我不确定它们是否能够很好地处理我面临的问题。

I query the database and get an array of user objects. 我查询数据库并获取用户对象数组。 I want to display these users as a form, with a radio button next to each of them and a submit button at the bottom of the page. 我想将这些用户显示为表单,每个用户旁边都有一个单选按钮,页面底部有一个提交按钮。

Here's roughly what the form will look like: 大致如下所示:

   [user id]  [email]         [full name]
( ) 1         test@test.com   Test user 1
(*) 2         test2@test.com  Test user 2
[SUBMIT]

Is this something achievable in a reasonably straightforward way or do I need to use the ViewScript partial? 这是可以以相当简单的方式实现的,还是我需要使用ViewScript部分?

You should easily achieve this layout Leveraging Zend Form Decorators . 利用Zend Form Decorators可以轻松实现此布局。

Edit: 编辑:

You may be interested also on Zendcasts: 您可能也对Zendcasts感兴趣:
Zend Form decorators explained and Creating custom Zend Form Decorators . Zend Form装饰器进行了说明,创建了自定义Zend Form装饰器

BTW, This is pretty common layout for preferences: 顺便说一句,这是首选项的常见布局:

Display preferences http://img707.imageshack.us/img707/3244/displaypreferences.gif 显示首选项http://img707.imageshack.us/img707/3244/displaypreferences.gif

Once you are finished, post your working code here for reference. 完成后,在此处发布您的工作代码以供参考。

Just a quick suggestion. 只是一个快速的建议。 Why do you need table for this? 为什么需要此表? The default definition list markup can be styled to look exactly like you want it to look. 可以定义默认定义列表标记的样式,使其看起来完全像您想要的样子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM