How to add checkbox field in Admin custom module form and populate the checkbox
$fieldset->addField(‘checkbox_name’, ‘checkbox’, array(
‘name’ => ‘ checkbox_name ‘,
‘onclick’ => ‘this.value = this.checked ? 1 : 0;’,
‘tabindex’ => 1
));
How to re-populate the checkbox on Edit page:
Just add the extra line in ablove code like below:
$fieldset->addField(‘checkbox_name’, ‘checkbox’, array(
‘name’ => ‘ checkbox_name ‘,
‘onclick’ => ‘this.value = this.checked ? 1 : 0;’,
‘tabindex’ => 1
))->setIsChecked($model->getCheckboxName());