On Tue, Mar 18, 2008 at 12:47 AM, ultimatenm <[EMAIL PROTECTED]>
wrote:
> I have the following code to create a select form element:
>
> $vFrmStatusOptions = array(
> 'Select' => array(
> '1' => 'Active',
> '2' => 'Inactive',
> '3' => 'Locked'
> )
> );
>
> $vFrmStatus =
> $vForm->createElement('select','sel_status');
> $vFrmStatus->setRequired(true)
> ->setOrder(1)
> ->setLabel('Status')
> ->setMultiOptions($vFrmStatusOptions)
> ->addDecorators(array(
> array('Label'),
> array('HtmlTag', array('tag' => 'td'))
> ));
>
> which renders:
>
> <select name="sel_status" id="sel_status">
> <optgroup label="Select">
> <option value="1" label="Active">Active</option>
> <option value="2" label="Inactive">Inactive</option>
> <option value="3" label="Locked">Locked</option>
> </optgroup>
> </select>
>
> My question is: How can I get rid of the 'optgroup' tags?
By not making your options array multidimensional. e.g.
$vFrmStatusOptions = array(
'1' => 'Active',
'2' => 'Inactive',
'3' => 'Locked'
);
Cheers,
>
> --
> View this message in context:
> http://www.nabble.com/Zend_Form_Element_Select-tp16106438s16154p16106438.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>