try:
'multiOptions' => array('Reader'=>'Reader', 'Author'=>'Author',
'Admin'=>'Admin'),



On Sat, Mar 6, 2010 at 10:55 PM, Steve Rayner <
[email protected]> wrote:

> I'm using this code to add a select element to my form;
>
> // Add the role element
> $this->addElement('select', 'role', array(
> 'id' => 'text',
> 'multiOptions' => array('Reader', 'Author', 'Admin'),
> 'label' => 'Role:',
> 'required' => true
> ));
>
> ...and then this in my controller to push the data to the database;
>
> $model->insert($form->getValues());
>
> for the field role it pushes values of 0,1 or 2 (ie the index of the item
> selected)
> How can i get it to push the text values instead?
>
> Usually i like the default behaviour of using indexs as it keeps the
> database small. Hoever, in this example i would like to use the text,
> because then the ACL is much more readable to the programmer (ie me).

Reply via email to