Putting some HTML next to the Zend form radio button

I built a form builder, and I need the ability to assign a description for each option in the radio element. After creating this radio element, I will ask the user to assign a description to each value, which should be shown next to the element. So, in my database, I have a value, title and description for each parameter in this radio element.

Question: How to put something next to a radio element? Should I create a new way for a form for rendering radio elements, or can this be done using decorators?

It helps a little, useful reading is also welcome!

Presentation of what I need:

**A title of the Radio element**
      O Option 1       -    A description for option 1    
      O Option 2       -    A description for option 2    
      O Option 3       -    A description for option 3    
      O Option 4       -    A description for option 4    

Any ideas?

+5
2

, abouts ?

, ViewHelper escape false, HTML


$form->addElement('radio', 'test', array(
    'label' => '**A title of the Radio element**',
    'multiOptions' => array(
        1 => 'Option 1 <strong>- A description for option 1</strong>',
        2 => 'Option 2 <strong>- A description for option 2</strong>'
    ),
    'escape' => false
));

Form screenshots

+12

All Articles