title: Using Acrobat X Pro, need javascript help
body: <p>I have a form that I have created in Acrobat X Pro. The form has several fields on it that a user would enter data in to get the cost of a photo session.</p>
  
  <p>Fields:
  Text1 (has a default value of $25. User cannot change this)<br>
  Text2 (has a default value of $15. Use cannot change this)<br>
  Text3 (is a numeric fillable field by the user. Values to be entered are from 1 - 5)<br>
  Text4 (is a numeric fillable field by the user. Values to be entered are 1 - infinity)<br>
  TotalCost (calculates the total of either Text1 x Text3 OR Text2 x Text4)  </p>
  
  <p>I need to write a javascript calculation for the TotalCost field. In Excel, i can write the formula like this: if(b9&lt;>"",b6*b9,if(b10&lt;>"",b7*b10,0)</p>
  
  <p>However, I am not sure how to write it in Javascript for the PDF form. I am thinking it is like:</p>
  
  <pre><code>var a = this.getField("Text1")
  var b = this.getField("Text2")
  var c = this.getField("Text3")
  var d = this.getField("Text4")
  
  total.cost = if(getField("text3").value &lt;&gt;"", getField("text1").value*getField("text3").value,if(getField("text4").value &lt;&gt;"",getField("text2").value*getField("text4").value,0))
  </code></pre>
  
  <p>am i correct or totally off the mark?</p>