Search code examples
phpzend-frameworkzend-formzend-decorators

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.

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         [email protected]   Test user 1
(*) 2         [email protected]  Test user 2
[SUBMIT]

Is this something achievable in a reasonably straightforward way or do I need to use the ViewScript partial?


Solution

  • You should easily achieve this layout Leveraging Zend Form Decorators.

    Edit:

    You may be interested also on Zendcasts:
    Zend Form decorators explained and Creating custom Zend Form Decorators.

    BTW, This is pretty common layout for preferences:

    Display preferences http://img707.imageshack.us/img707/3244/displaypreferences.gif

    Once you are finished, post your working code here for reference.