0
votes

This is my code to generate a select element:

$configsForm->addElement( 
 'select',
        'option_status',
        array(
            'label'         => $this-> view -> __('Configs_Option Status'),
            'required'      => true,
            'value'         => '',
            'multiOptions'  => array('' => $this -> view -> __('Root'), 0 => 'Disabel', 1 => 'Enabel'),
        )
    );

And the generated select like this

<select name="configs[option_status]" id="configs-option_status" required="1">
    <optgroup id="configs-option_status-optgroup-options" label="options">
        <option value="" label="Select option" selected="selected">Select option</option>
        <option value="0" label="Disabel">Disabel</option>
        <option value="1" label="Enabel">Enabel</option>
    </optgroup>
    <option value="listsep" label="&lt;br /&gt;">&lt;br /&gt;</option>
    <option value="id" label="configs-option_status">configs-option_status</option>
</select>

It should be like this

    <select name="configs[option_status]" id="configs-option_status" required="1">
        <option value="" label="Select option" selected="selected">Select option</option>
        <option value="0" label="Disabel">Disabel</option>
        <option value="1" label="Enabel">Enabel</option>
</select>

How this can render ?

1
I want the select rendered as the last psudo code ! - user1476552

1 Answers

0
votes

You indeed set two options ('Disabel' and 'Enabel'), but you also set another option: $this->view->__('Root'). Are you sure this only returns "Select Option"?

Could you perform a Zend_Debug::dump($this->view->__('Root')) and show what the output is? I think that will help you solve your problem.