title: Removing a field from a form generated by YII2 ActiveForm
body: <p>I have a form generated using YII2 ActiveForm. there are some field I need to be on the if I select certain options , or need to have them removed if I select some other option. </p>
  
  <p>For e.g. I Have a dropdown AccountType, with two options "individual" and "company". 
  If the user selects "individual" some fields on the form needs to go away say company name, and some other fields need to appear such as First name, last name. Initially when the display the form , only the Account Type field is there. </p>
  
  <p>below is the code I have at the moment</p>
  
  <pre><code>&lt;?php 
   $form = ActiveForm::begin(['id' =&gt; 'account-setup-form']); ?&gt;
   echo $form-&gt;field($modelAccMain, 'account_type')
             -&gt;widget(Select2::classname(), [
              'data' =&gt; $accountTypeArray,
              'options' =&gt; ['placeholder' =&gt; 'Select account type'],
              ]);         
    echo $form-&gt;field($modelUsers, 'firstname')-&gt;textInput()
              -&gt;hint('')-&gt;label('First Name');
    echo $form-&gt;field($modelUsers, 'lastname')-&gt;textInput()
              -&gt;hint('')-&gt;label('Last Name');
  &lt;?php ActiveForm::end(); ?&gt; 
  </code></pre>
  
  <p>Any help is greatly appreciated.   </p>