In my case I want the default to be the last value added instead of
the first which is why I manually do a setValue in the init.

Chris


On Thu, Sep 11, 2008 at 10:19 AM, Bruno Friedmann <[EMAIL PROTECTED]> wrote:
> Chris Tankersley wrote:
>> I have a select element inside of a form object where I call
>> ->setValue() on the form's initialization to select a default value.
>> When I do a $form->populate($data) in my controller the value for this
>> select element is not being set correctly and always defaults to the
>> default value from initialization. My other select elements in the
>> form work fine except for this one.
>>
>> ====FORM====
>> $protClass = new Zend_Form_Element_Select('protClass');
>> $protClass->setLable('Protection Class:')
>>                 ->setRequired(true)
>>                 ->setValue(9)
>>                 ->setMultiOptions($protClassRange);
>>
>> ====CONTROLLER====
>> $form->populate($rate->toArray()); // this has protClass at the correct value
>
> Dear Chris, in my case there's no need to setValue when populate ..
> it's done auto.
>
>
> --
>
>     Bruno Friedmann
>
>

Reply via email to