aha sorry it works
Colin Guthrie-6 wrote:
>
> 'Twas brillig, and denadai2 at 30/04/09 10:58 did gyre and gimble:
>> I've a problem: using getvalues i have an empty array as returned values.
>> This appens if i submit the correct form, an empty form or if i put some
>> chars.
>>
>>
>> $form = new forms_RegisterForm();
>>
>> if ($this->getRequest()->isPost())
>> {
>> $values = $form->getValues();
>> print_r($values);
>> if ($form->isValid($_POST))
>> {
>>
>> }
>> else
>> {
>> $form->populate($values);
>> }
>> }
>
> Look at the examples again. You've not told your form where the values
> are coming from. It doesn't know that you want to get them from POST, so
> it's effectively not populated yet.
>
> You can populate it manually, but it doesn't make much sense in your
> example above. Calling isValid() will populate the form with the values
> you give it.
>
> Try:
>
> if ($this->getRequest()->isPost())
> {
> if ($form->isValid($this->getRequest()->getPost()))
> {
> $values = $form->getValues();
> print_r($values);
> ...
> }
> }
>
> --
>
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
>
> Day Job:
> Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
> Mandriva Linux Contributor [http://www.mandriva.com/]
> PulseAudio Hacker [http://www.pulseaudio.org/]
> Trac Hacker [http://trac.edgewall.org/]
>
>
>
--
View this message in context:
http://www.nabble.com/Zend_form-and-getValues-%3D%3E-empty-array-tp23313199p23314911.html
Sent from the Zend Framework mailing list archive at Nabble.com.