Closed trinkity closed 7 years ago
solved with echo SwitchInput::widget([ 'name' => 'remember_friends', 'value' => ($remember_friends_switch==1) ? 1 : 0 , 'pluginOptions' => [ 'state' => $remember_friends_switch, 'size' => 'medium', 'onColor' => 'success', 'offColor' => 'danger', ] ]);
This is my configuration:
echo SwitchInput::widget([ 'name' => 'remember_friends', 'value' => ($remember_friends_switch) ? 'on' : 'off', 'pluginOptions' => [ 'state' => $remember_friends_switch, 'size' => 'medium', 'onColor' => 'success', 'offColor' => 'danger', ] ]);
The first time i click on switch button and submit form I've $_POST['remember_friends'] == 'on'. in server side set $remember_friends_switch = true and correctly the switch button show me on state. If i resend submit (WITHOUT click on switch button) the $_POST['remember_friends'] is null !!! Must be on !