Closed jonny7 closed 6 years ago
Having a little trouble with this. My model has a field that takes Y and N. But my switch always says OFF, even though the value in the $model is Y. I can't set it explicitly either. What am I doing wrong.
Y
N
OFF
$form->field($personPhoneRecord->personPhone, 'PRIMARY')->widget(SwitchInput::classname(), [ 'options' => [ 'id' => 'phone'], 'value' => true, 'pluginOptions' => ['size' => 'mini','onColor' => 'success', 'offColor' => 'danger'] ]);
Using this to set the value before called switchInput
$var = $personPhoneRecord->personPhone['PRIMARY'] = ( ( $personPhoneRecord->personPhone['PRIMARY'] == 'Y') ? true : false);
Having a little trouble with this. My model has a field that takes
Y
andN
. But my switch always saysOFF
, even though the value in the $model isY
. I can't set it explicitly either. What am I doing wrong.