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? My first idea is to write a 
decorator called ViewHelpers which would take element names to render, in this 
case I'd set it to fieldName like this:

$fieldName->setDecorators(array(
        'Label',
        'ViewHelper',
        array('ViewHelpers, array('elements' => array('sortOrder'))),
        // rest of it
));

Do you see any obvious flaws in this plan?

-- 
Dado

Reply via email to