-- Dennis Becker <[EMAIL PROTECTED]> wrote
(on Tuesday, 19 February 2008, 04:29 PM +0100):
> But what if I don't want to use 'label' at the submit button? I only want to
> use 'value'.

First off, what's happening internally is that the label is used for the
element value -- which ends up becoming the *displayed* button value.
Label == display, value == value.

There are a variety of reasons behind this:

  * To allow translations. If you have the value translated, then
    the form attempts to translate submitted form values, leading to
    issues.

  * Ability to compare the submitted value against the label. This can
    be an addtional sanity check to see that the form is being submitted
    from the location you expect it, and is used internally by
    isClicked() to determine if the button was clicked when submitting
    the form.

  * Ability to specify a different value than the label so that when the
    form is submitted, you can have one thing displayed, and another
    actually saved in your model.

If you don't like the implementation, you're free to create your own
implementation and drop it in using the plugin loader system. :-)


>     2008/2/19, Matthew Weier O'Phinney <[EMAIL PROTECTED]>:
>     -- Dennis Becker <[EMAIL PROTECTED]> wrote
>     (on Tuesday, 19 February 2008, 01:54 PM +0100):
>     > I have created a small form for testing the new Zend_Form component. Can
>     anyone
>     > tell me, why I cannot set the "value" property for a 'submit' button?
>     Instead,
>     > the 'submit' button uses the value for 'label' and I cannot deactive the
>     label
>     > for 'submit'. For me it looks like a bug, but I'm not sure.
> 
>     This is by design.
> 
>     We use the label of the element, as this is what is *displayed* to the
>     end user. It also allows us to check the submitted value against the
>     label to determine (a) if the given submit button was used, and/or (b)
>     if somebody's potentially monkeying with the form. As an example,
>     Zend_Form_Element_Submit::isChecked() checks the submitted value
>     against the label, for instance; if they match, isChecked() returns
>     true.

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to