On Wed, Jun 12, 2013 at 6:41 AM, Andreas Möller <[email protected]> wrote:
>> No they wouldn't, so don't pass it to setData. But I should imaging people 
>> would want to set the value on the submit element programtically, I don't 
>> think there is a distinction between posted form data and normal setter 
>> data, I think that may be the issue?
>
> The problem I see with this is that then, you would have to fiddle with the 
> form and request data and need to check whether the request data contains a 
> value for a submit element (which the form may or may not have).
>
> Typically, in a controller action I would just retrieve the data from the 
> postRedirectGet-plugin and pass it on to the form without worrying about the 
> details of what elements the form contains or for what elements data is 
> present in the requested data. Don't you agree?

Not really. Usually I don't associate validation with submit buttons,
so I don't care. That said, I see your point about the *view* *layer*,
where we may not want to set the value on it.

That said, if they do, the only time I'd worry about it is if I'm
doing switches based on the submit value. In such a case, though, you
simply have a default case that reports an error.

> I believe that $form->populateValues() should not populate submit elements.

I disagree with that. There are use cases where the submit value might
change -- you may have several buttons with the same name but
different values, and those may be used for branching or even be
something you want persisted. Making a blanket case that they should
never be included is problematic, especially as you can easily restore
the value if necessary, or handle it via validation.

--
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

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


Reply via email to