title: Yii2 - Update database field when switchinput widget is clicked
body: <p>I am using the switchinput Kartik widget which I have related to a database true/false field (field1). What I want to do is to be able to update this database field value when I change the switch.</p>
  
  <p>Here is the view code:</p>
  
  <pre><code>&lt;?php 
      echo $form-&gt;field($model, 'field1')-&gt;widget(SwitchInput::classname(), [
      'type' =&gt; SwitchInput::CHECKBOX,
      'name' =&gt; 'status_11',
      'pluginOptions' =&gt; [
          'size' =&gt; 'medium',
          'onColor' =&gt; 'success',
          'offColor' =&gt; 'danger',
          'handleWidth'=&gt;80,
          'onText'=&gt;'ACTIVE',
          'offText'=&gt;'INACTIVE'
      ]
          ]);
  ?&gt;
  </code></pre>
  
  <p>and here is the controller code that tries to update the database:</p>
  
  <pre><code>.................    
  if (isset($_POST['status_11']))
                      {
                          if ($model-&gt;field1 == False)
                          {
                              $model-&gt;field1 = True;
                          }
                          else
                          {
                              $model-&gt;field1 = False;
                          }
                      }
                      if(!$model-&gt;save())
                      {
                          throw new Exception('Could not save to database. Trnasaction aborted.');
                      }
  ..................
  </code></pre>
  
  <p>The switch can read from the database the value of field1 and show on or off respectively. But the change (onclick) action does not update the database...</p>
  
  <p>Should I try using PHP or should I implement it with js ('pluginEvents' widget option) and how?
  Any suggestions would be highly appreciated. Thank you in advance.</p>