validation issue with zend checkbox
everyone, I have create a zend form have a checkbox for license agreement. I want to s开发者_JAVA技巧how an error message when a user submit the form with out checking the agreement check box.
Thanks Anurodh
There is a bug in zend_framework with the required checkbox. But you can do something like this.
$this->addElement(
'checkbox', 'checbkox_name', array(
'required' => true,
'uncheckedValue' => null
)
);
edit for readability
$acceptAggrement = new Zend_Form_Element_Checkbox('accept_aggrement');
$acceptAggrement->setLabel("Accept Aggrement :");
$acceptAggrement->setUncheckedValue(null);
$acceptAggrement->setRequired(true);
精彩评论