-- Jacky Chen <[EMAIL PROTECTED]> wrote
(on Tuesday, 25 March 2008, 01:48 PM +0800):
> and how can i use checkbox in the Zend_Form?
Examples:
$checkbox = new Zend_Form_Element_Checkbox('foo');
$checkbox->setCheckedValue('true')
->setUncheckedValue('false');
$checkbox->setValue('true') // implicitly sets as 'checked'
$checkbox->setChecked(true) // implicitly sets value to checkedValue,
// ('true' in this case)
// Any value not matching the checkedValue will mark the element as not
// checked, and set the value to the uncheckedValue:
$checkbox->setValue('lalala');
// Implicitly sets the value to the uncheckedValue:
$checkbox->setChecked(false);
// Is the value checked?
if ($checkbox->isChecked()) { }
By default, the checkedValue is '1' and the uncheckedValued is '0'; the
above are to show that you can set them to whatever values you want.
> 2008/3/24, Matthew Weier O'Phinney <[EMAIL PROTECTED]>:
>
> -- Jacky Chen <[EMAIL PROTECTED]> wrote
> (on Monday, 24 March 2008, 05:06 PM +0800):
>
> > i found that view helper of formCheckbox not display options
> > elements,is it a bug or not?
>
>
> I need to update the documentation for that helper. Basically, the
> fourth "$options" parameter is no longer used. If you want to mark
> the element as checked, you need to pass a 'checked' option in the
> $attribs array.
>
> The reason the $options array was removed is because the prior
> implementation was extremely buggy and did not follow w3c
> specifications.
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/