I'm working on a rails form which contain two text-fields. Each text-fields are fed values through a look-up button which popups modal windows, which will trigger an Ajax call to fetch values. Then I select the values and set the values to the text-box fields.
The problem I'm facing is, when I set value in the second text-field, the page gets refreshed and first value in the text-box gets updated.
In my controller for form I'm capturing the param values from each modal and passing to the template. But when setting the second textfield value parent page gets refreshed and so the previous value get lost. 
My question is, how to set two values before the form is submitted.
<td><%= f.text_field_tag(:node, :id, value: "#{@node_id}", class: "form-control", :readonly => true )%></td>

