title: Yii2 add class or function to dropdownlist form field
body: <p>i need to add a class and a function to a dropdownlist in Yii2 activeform, here's the code:
  <code></p>
  
   
  
  <pre><code>&lt;?= $form-&gt;field($model, 'tipocontratto')-&gt;dropDownList(['RES' =&gt; 'Residenziale', 'BUS' =&gt; 'Business'], ['prompt'=&gt;'Seleziona...'],['maxlenght'=&gt; true]); ?&gt;
  </code></pre>
  
  <p></code>
  I need to specify a class for the field and also a javascript function.
  In normal textfield i make this way:
  <code>
  field($model, 'cogn_ragsoc')->textInput(['maxlength' => true,'class'=>'form-control formtesto','onfocus'=>'test()']) ?>
  </code>
  andd it works perfectly, but in dropdownlist it doesn't
  How can i do?</p>