目前,我有一个现有的代码,基于表User的ban_time字段显示用户状态为“非活动”或“活动”。当用户的状态是“无效”,该ban_time场将由目前的入库时间进行更新(我猜它使用外部包装插件)将用户状态从SwitchInput更改为下拉列表
$form->field($user, 'ban_time')->widget(SwitchInput::classname(), [
'type' => SwitchInput::CHECKBOX,
'containerOptions' => ['class' => 'inner-form-group'],
'pluginOptions' => [
'state' => empty($user->ban_time),
'handleWidth' => 60,
'onText' => 'Active',
'offText' => 'Inactive'
],
'pluginEvents' => [
"switchChange.bootstrapSwitch" => "function(event, state) { $('[name=\'User[ban_time]\']').val(state ? 0 : 1) }",
]
])->label('Status');
现在,我需要补充,而不是“无效”或“主动多个状态”。所以我想改变这个领域进入DROPDOWNLIST但改变用户的登陆状态时,ban_time没有改变
$form->field($user, 'ban_time')->dropDownList(
[empty($user->ban_time) =>'Active', !empty($user->ban_time) =>'Inactive']
)->label('Status');
请帮助我如何去改变它
那么确切的问题是什么?显示下拉列表?或者保存'ban_time'? – arogachev
保存ban_time是问题 –
现在如何处理它? – arogachev