rails use form input value before save
<p>I have a form in rails with input values, and 1 of the values is a LOV (List of Values) and a second input field is also a LOV but depends on the input of the other field.
The input value of the first field is not saved in between. So I need to use that field value before it is saved.
So, the example:
I choose a company from the list of values of all companies for the field supplier, the second field supplier_address will be a LOV with all the addresses of that company, so the LOV of the second field is dependent on the value chosen in the first field, company.</p>

<p>What I tried:</p>

<pre><code>  def new
    @purchase_requisition = PurchaseRequisition.new
    @purchase_requisition.number = find_next_user_value("Purchase_Requisition")
    #@purchase_requisition.supplier_address_id =  PurchaseRequisition.new.purchase_requisition_params[:supplier_id]
    @purchase_requisition = PurchaseRequisition.new(purchase_requisition_params)

    respond_to do |format|
      @purchase_requisition.supplier_address_id = PurchaseRequisition.new.purchase_requisition_params[:supplier_id]
    end
  end
</code></pre>

<p>but I still get the error:</p>

<blockquote>
  <p>param is missing or the value is empty: purchase_requisition</p>
</blockquote>

<p>Can someone please help me?
Thank you!!!</p>