I don't think getValidValues() is the right method for your needs.

When you call isValid($data) on a form, the form elements are
populated and validated. getValidValues() is expecting a parameter of
$data as well, but in looking through the code it looks like it passes
on values that don't exist in the form.

So, instead you should just call getValues() on the form. This will
return only the values for form elements that exist in the form.

Konr

On Thu, Sep 15, 2011 at 4:50 PM, Sergio Rinaudo
<kaiohken1...@hotmail.com> wrote:
>
> Hello Everyone,
> I am a bit confused with the "getValidValues" method of Zend_Form.
> I am using ZF 1.11.10.
>
> I'll explain my problem:
>
> I'm trying to get all the valid values of the $data array.
>
> $isValid = $form->isValid( $data );
>
>            if( $isValid ) {
>                $validValues = $form->getValidValues();
>                Zend_Debug::dump( $validValues, 'validValues' ); exit;
>            } else {
>                 Zend_Debug::dump( $form->getErrors() ); exit;
>            }
>
> If $data contains keys that are not form elements, $validValues will contains 
> them.
> Is that the correct behaviour of this method?
>
> The result I would is an array of data that is valid and is present as a form 
> element, discarding what is not present,
> is there any way to accomplish this using Zend Form methods or maybe am I 
> mistaking something?
>
> Thanks
>
> Sergio
>
>
>

--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to