title: Pre-populate form fields based on form input from query
body: <p>I have input form fields that I want to pre-populate when I type in for example an order # in one of the input boxes. I have successfully wrote the query and outputted it successfully by doing a cfdump. however, I can't figure out how I would auto populate these fields based on what I put in for the order number in the form text field for it? If I put the variables from the query that I prepared into the <code>value</code>, it'll pre-populate the form fields but I want the form fields to update based on what I put in for the order #? </p>
  
  <p>Would I have to use JavaScript in order to accomplish this?</p>
  
  <p><strong>Here are my Input forms.</strong> </p>
  
  <pre><code>&lt;label for="ordernum"&gt;Order #&lt;/label&gt;
  &lt;input type="text" name="ordernum" value=""&gt;
  &lt;label for="companyname"&gt;Company Name&lt;/label&gt;
  &lt;input type="text" name="companyname" value=""&gt;
  &lt;label for="resident"&gt;Resident&lt;/label&gt;
  &lt;input type="text" name="resident" value=""&gt;  
  &lt;label for="complexname"&gt;Complex Name&lt;/label&gt;
  &lt;input type="text" name="complexname" value=""&gt;
  &lt;label for="suitenum"&gt;Suite #&lt;/label&gt;
  &lt;input type="text" name="suitenum" value=""&gt;
  </code></pre>
  
  <p>Here is my query</p>
  
  <pre><code>&lt;cfquery name="testForm" datasource="randomData"&gt; 
  SELECT [COMPANY NAME] AS COMPANYNAME, [RESIDENT], [COMPLEX NAME] AS 
  COMPLEXNAME, [SUITE##] AS SUITE, [ORDER##] AS ORDER
  FROM tests.DB
  WHERE [ORDER##] = 112211
  &lt;/cfquery&gt;
  </code></pre>
  
  <p>What I tried initially was wrapping those form input fields into a cfoutput query and assigning the variable to the <code>value</code> input field but thats pre-populating it I want the form information to update. based on what I put in for the order number field.</p>
  
  <p>Any advice would be greatly appreciated.</p>