title: Yii2 pass value from text field to form model field
body: <p>New to Yii2 and looking for some assistance, I have an address form that contains textinput boxes populated with address values and I would like to pass these values to ActiveForm on the same form. 
  Thanks in advance.</p>
  
  <pre><code> &lt;form&gt; &lt;textarea id="address1"&gt;&lt;/textarea&gt; pass value to &lt;?= $form-&gt;field($model, 'address1')-&gt;textInput() ?&gt; 
  
  this is the form code;
  
  &lt;?php
  
  use yii\helpers\Html;
  use yii\widgets\ActiveForm;
  
  ?&gt;
  
  &lt;div&gt;
  &lt;h1&gt;Address Search&lt;/h1&gt;
      &lt;div id="main"&gt;
        &lt;div id="addressSearch"&gt;
      &lt;input type="text" id="searchQuery"&gt;
      &lt;input type="submit" value="Search" id="searchBtn"&gt;
      &lt;div id="searchResult"&gt;
      &lt;/div&gt;
        &lt;/div&gt;
          &lt;br&gt;
        &lt;form&gt;
      &lt;textarea id="address1"&gt;&lt;/textarea&gt;&lt;br&gt;
          &lt;input type="text" id="town"&gt;&lt;br&gt;&lt;br&gt;
          &lt;input type="text" id="postcode"&gt;&lt;br&gt;&lt;br&gt;
          &lt;input type="text" id="locator_point"&gt;
        &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="address-form"&gt;
  
      &lt;?php $form = ActiveForm::begin(); ?&gt;
  
      &lt;?= $form-&gt;field($model, 'address1')-&gt;textarea() ?&gt;
  
      &lt;?= $form-&gt;field($model, 'town')-&gt;textInput() ?&gt;
  
      &lt;?= $form-&gt;field($model, 'postcode')-&gt;textInput() ?&gt;
  
      &lt;?= $form-&gt;field($model, 'locator_point')-&gt;textInput() ?&gt;
  
      &lt;div class="form-group"&gt;
          &lt;?= Html::submitButton($model-&gt;isNewRecord ? 'Create' : 'Update', ['class' =&gt; $model-&gt;isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?&gt;
      &lt;/div&gt;
  
      &lt;?php ActiveForm::end(); ?&gt;
  
  &lt;/div&gt;
  </code></pre>