Hi all,
With my Zend_Form I'm populating a single optin checkbox. After submission,
when the form is not valid and is rerendered, it fails to have remembered the
checkbox's state. It seems to populate a default value of "0" in the hidden
element (which I think is correct) but also in the checkbox input element as
well.
$newsletterOptin = new Zend_Form_Element_Checkbox( 'newsletterOptin' );
$newsletterOptin->setDecorators( $decorators )
->setLabel( 'Yes, I want to subscribe to your
newsletter' )
->setAttribs( array( 'value' => '1' ) );
I tried the following, but all to no avail:
->setCheckedValue( 1 )
->setCheckedValue( "1" )
->setValue( 1 )
->setValue( "1" )
->setAttribs( array( 'value' => '1' ) )
To populate the checkbox I vahe the following code in my ViewScript:
<dd>
<?= $form->newsletterOptin->renderViewHelper(); ?> <?=
$form->newsletterOptin->renderLabel(); ?>
</dd>
Any idea of what is going on here? Thanks.
_________________________________________________________________
Jouw nieuws en entertainment, vind je op MSN.nl!
http://nl.msn.com/