On Monday 13 July 2009 16:58:03 Matthew Weier O'Phinney wrote: > -- Dalibor Karlović <d...@krizevci.info> wrote > > (on Monday, 13 July 2009, 11:56 AM +0200): > > I have two selects: fieldName and sortOrder, I'd like to render them like > > > > <div class="field"> > > <label for="fieldName">Sort by</label> > > <select id="fieldName" name="fieldName">(...)</select> > > <select id="sortOrder" name="sortOrder"> > > <option>ASC</option> > > <option>DESC</option> > > </select> > > </div> > > > > and without using the view script for the form (this part is really > > important, if it wasn't, this wouldn't warrant a question here :) ) > > > > So, the question is: how would you go about it? > > I'd use a DisplayGroup, and assign minimal decorators to each of the > elements: > > $form->addElement('select', 'fieldName', array( > // ... > 'decorators' => array('ViewHelper', 'Label'), > )); > $form->addElement('select', 'sortOrder', array( > // ... > 'decorators' => array('ViewHelper'), > )); > > $form->addDisplayGroup(array('fieldName', 'sortOrder'), 'field', array( > 'decorators' => array( > 'FormElements', > array('HtmlTag', array('tag' => 'div', 'class' => 'field')), > ), > ));
DOH! I forgot about DisplayGroup, in my mind it was == fieldset. :) Thanks, Matthew. -- Dado