开发者

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); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜