О.К. I'm using buttons (type="submit").

Does for you this method returns opposite value then expected?

Regards,
Saša Stamenković


On Mon, Dec 21, 2009 at 6:04 PM, Hector Virgen [via Zend Framework
Community] 
<[email protected]<ml-node%[email protected]>
> wrote:

> That's because you can have two buttons with the same name but have
> different values. Only if the value matches will it be considered clicked.
>
> Also, with inputs (type=submit), the value and the label are the same
> thing. To make your button say "OK", its value should be "OK". When the
> button is clicked, the $_POST data will contain the value "OK" for the
> button. In ZF, that's why $element->setLabel() affects the value of the
> submit input.
>
> When it's not clicked, there may still be another input (hidden?) that sets
> the value to an empty string. This is why the label is tested against the
> value.
>
> --
> Hector
>
>
> On Mon, Dec 21, 2009 at 6:31 AM, umpirsky <[hidden 
> email]<http://n4.nabble.com/user/SendEmail.jtp?type=node&node=976348&i=0>
> > wrote:
>
>>
>> Hi.
>>
>> For me, isChecked method works only after I set my buttons (type="submit")
>> have same value for label and value attribs.
>> Also, it returns opposite value then expected, false when button is
>> clicked!
>>
>> Lets take a look at buton/submit isChecked method:
>>
>> /**
>>  * Has this submit button been selected?
>>  *
>>  * @return bool
>>  */
>> public function isChecked()
>> {
>>        $value = $this->getValue();
>>
>>        if (empty($value)) {
>>                return false;
>>        }
>>        if ($value != $this->getLabel()) {
>>                return false;
>>        }
>>
>>        return true;
>> }
>>
>> pretty odd, huh? I don't know why it is implemented this way, but I
>> patched
>> it to return opposite value, and it works now. Why label and value need to
>> have same value at all?
>>
>> Anyone with same behaviour?
>> --
>> View this message in context:
>> http://n4.nabble.com/Buttons-and-isChecked-method-tp976255p976255.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>
>
>
> ------------------------------
>  View message @
> http://n4.nabble.com/Buttons-and-isChecked-method-tp976255p976348.html
> To unsubscribe from Buttons and isChecked method, click here< (link removed) 
> >.
>
>
>

-- 
View this message in context: 
http://n4.nabble.com/Buttons-and-isChecked-method-tp976255p976764.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to