Actually, the setValue in the init is working fine. What I'm having a
problem with is after I populate the form with data the select isn't
changing to the populated value.
Chris
On Thu, Sep 11, 2008 at 10:50 AM, Bruno Friedmann <[EMAIL PROTECTED]> wrote:
> Ok sorry.
>
> I'm doing what you want in several forms but index are always called by
> string.
> Have you try a setValue('9') if I imagine you have a id='9' value='Something
> in the list'
>
> Hope this help a bit more ...
>
>
> Chris Tankersley wrote:
>> 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
>>>
>>>
>
>
> --
>
> Bruno Friedmann
>
> Ioda-Net Sàrl
> 2830 Vellerat - Switzerland
>
> Tél : ++41 32 435 7171
> Fax : ++41 32 435 7172
> gsm : ++41 78 802 6760
> www.ioda-net.ch
>
> Centre de Formation et de Coaching En Ligne
> www.cfcel.com
>
>