Reputation: 27038
i was wondering how to style a zend form:
// Pants
$this->addElement('select', 'waistmin', array(
'label' => 'Pants: ',
'multiOptions' => array_merge(array(''=>'', 'Any'=>'Any'),array_combine(range(21, 48), range(21, 48)) ),
'value' => 'Any'
));
$this->addElement('select', 'waistmax', array(
'label' => 'to: ',
'multiOptions' => array_merge(array(''=>'', 'Any'=>'Any'),array_combine(range(21, 48), range(21, 48)) ),
'value' => 'Any'
));
// Bust & Chest
$this->addElement('select', 'bustmin', array(
'label' => 'Bust & Chest: ',
'multiOptions' => array_merge(array(''=>'', 'Any'=>'Any'),array_combine(range(30, 50), range(30, 50)) ),
'value' => 'Any'
));
$this->addElement('select', 'bustmax', array(
'label' => 'to: ',
'multiOptions' => array_merge(array(''=>'', 'Any'=>'Any'),array_combine(range(30, 50), range(30, 50)) ),
'value' => 'Any'
));
i have this form in a form.php and i place in in my view file by using echo $this->form;
i know that i can add style tags and id tags, but what i want it so position them better.
right now they come one after each other:
Pants:
<drip down>
to:
<drip down>
Bust & Chest:
<drip down>
to:
<drip down>
i want to group the together in divs or maybe in a table:
Pants: to:
<drip down> <drip down>
Bust & Chest: to:
<drip down> <drip down>
if i echo html inside the form it will not render inside my page.
any ideas on what approach i can take?
thans
Upvotes: 0
Views: 2654
Reputation: 2978
Why dont you simply do CSS for the dl, dt and dd Zend Forms use. That will allow you to modify their styling
Upvotes: 0
Reputation: 841
Аccording zend documentation you should use decorators to change markup of your form elements, also try $form->render() insetad echo. http://framework.zend.com/manual/en/zend.form.standardDecorators.html
Upvotes: 0
Reputation: 69937
If you want to have more control over how and where individual form elements are displayed, you can output individual form elements and wrap them in html as you see fit.
See the answer here. This answer on splitting up a zend form may help you as well as it shows how to remove decorators from the select element so it isn't wrapped in any html which will work well with the example below.
Instead of doing echo $this->form;
you can do something like the following:
<div class="form-sel">
Pants: <?php echo $this->form->waistmin ?> to: <?php echo $this->form->waistmax ?>
</div>
<div class="form-sel">
Bust & Chest: <?php echo $this->form->bustmin ?> to: <?php echo $this->form->bustmax ?>
</div>
Upvotes: 1