I have 2 checkboxes
$fieldset->addField(
'call_me_in_morning',
'checkbox',
array(
'name' => 'call_me_in_morning',
'label' => __('Call me in morning'),
'title' => __('call me in morning'),
'data-form-part' => $this->getData('career-form'),
'onchange' => 'this.value = this.checked ? 1 : 0;',
)
);
$fieldset->addField(
'call_me_in_aftenoon',
'checkbox',
array(
'name' => 'call_me_in_aftenoon',
'label' => __('Call me in aftenoon'),
'title' => __('call me in aftenoon'),
'data-form-part' => $this->getData('career-form'),
'onchange' => 'this.value = this.checked ? 1 : 0;',
)
);
Getting right values for both checkboxes.
You can see in following image
Getting value = '1' for 1st
and value = '0' for second
But when I'm going to edit row of grid then it remains unchecked.
What should I do to show checked whose value = '1'
Note : Highlited box in inspect element is for 2nd checkbox and for 1st is above it.
Best Answer
To achieve this functionality I had changed my html:
Then used below code:
Now working fine.