开发者

CakePHP FormHelper - Can't disable multiple checkboxes

开发者 https://www.devze.com 2023-01-03 09:55 出处:网络
I\'ve got the following in my view: echo $form->input(\'Category\', array(\'multiple\' => \'checkbox\', \'disabled\' => true));

I've got the following in my view:

echo $form->input('Category', array('multiple' => 'checkbox', 'disabled' => true));

But, the checkboxes aren开发者_运维技巧't disabled...


Try the checkbox() method in the form helper. API link: http://api.cakephp.org/class/form-helper#method-FormHelpercheckbox

Just change your syntax (I think it's just a wrapper around the FormHelper::input, but this should work):

echo $form->checkbox( 'Category', array( 'disabled' => true ) );

If that doesn't work, post the HTML that is output from your call.


I think you should pass true as string like:

echo $form->checkbox( 'Category', array( 'disabled' => 'true' ) );

If this doesn't work use

echo $form->checkbox( 'Category', array( 'disabled' => 'disabled' ) );
0

精彩评论

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

关注公众号