title: PDF JavaScript: Insert value of variable into form field
body: <p>I have a PDF with JavaScipt, all end users running Adobe Acrobat Pro DC. I have successfully figure out how to get it to fill a form field with values from other form fields:</p>
  
  <pre><code>// Assuming FormFieldB has a value of "somewhere" and FormFieldA is a text box
  
  this.getField("FormFieldA").value = "Fills a sentence and adds a string from " + this.getField("FormFieldB").value + " successfully.";
  
  // This fills the box with "Fills a sentence and adds a string from somewhere successfully.
  </code></pre>
  
  <p>But what I'm trying to do is basically the same thing but I'm trying to take the value of a <strong>variable</strong> and add it into the form field.</p>
  
  <pre><code>var my_variable = "somewhere";
  
  this.getField("FormFieldA").value = "Fills a sentence and adds a string from &lt;How do I insert from my_variable&gt; successfully";
  
  // I want it do write the same example sentence as before
  </code></pre>
  
  <p>Any ideas? Thanks!</p>