I'm having a similar problem...

I'm also wondering why Zend_Form->validate($data) isn't validating against
the default value (or current value for that matter) when the value isn't
present in the $data array. What's the reason for this behavior?

Should the code not be 

            if (!isset($check[$key])) {
                $valid = $element->isValid($element->getValue(), $context)
&& $valid;

instead of 

            if (!isset($check[$key])) {
                $valid = $element->isValid(null, $context) && $valid;

My situation (perhaps irrelevant but still):

I'm having an authentication mechanism which forwards the request to the url
the user wanted to go to before he came to the authentication form.

For example the user wants to go to
http://www.mysite.com/someobject/index/edit/id/123, but he's not logged in.
My authentication plugin's preDispatch method intercepts the request and
fowards it to my authentication action which shows a login form. The user
fills in the form and is then being forwarded to the original url.  In the
action where the user is being forwarded to the request is still a post,
which results in validating the form with this post. The end-result is that
the form does not validate, which is great, but I'm also losing my default
values, which came from the object being edited.

Is there a way I can solve this without redirecting (instead of forwarding)
to the intended url? I don't want to start another bootstrap, so I want to
forward not redirect...

--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/default-value-not-taken-into-account-when-validating-a-form-tp2320504p3403190.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to