使用 yii2 kartik开关输入,我想明确设置开关输入的true和false值
这是开关输入
grow_polyline: (path, encoded, interval) =>
if encoded
poly_path = google.maps.geometry.encoding.decodePath(path)
else
poly_path = path
full_polyline = new google.maps.Polyline
path: poly_path
grow_polyline = new google.maps.Polyline
path: []
geodesic: true
strokeColor: '#e87767'
strokeOpacity: 1.0
strokeWeight: 7
map: @map
i = 0
full_polyline.getPath().forEach (latLng) =>
window.timeouts.push setTimeout ((coor) ->
grow_polyline.getPath().push coor
), interval*i, latLng
i++
我使用开关输入来更新字段,如果<?php
echo $form->field($model, 'PR_Status_ID')->widget(SwitchInput::classname(), [])->label(false);;
?>
的值 6 ,我希望关闭开关输入,如果值 7则打开
我该如何实现?
答案 0 :(得分:1)
只需根据更新案例的PR_Status_ID
字段设置初始值:
echo $form->field($model, 'PR_Status_ID')->widget(SwitchInput::classname(), [
'value' => (!$model->isNewRecord && $model->PR_Status_ID == 6) ? false : true,
])->label(false);