2 Replies Latest reply on Dec 1, 2015 3:16 AM by ml34626372

    Adobe javascript syntax help

    ml34626372

      Hello,

       

      Regards to all. I am a new to Acrobat javascript and the forum and should be grateful for any pointers on a problem with a script I am writing.

       

      The script is to auto populated a text field (Text1) with a fixed number depending on the selections made in a combobox (ComboBox1) and a checkbox (Checkbox1). ComboBox1 has 4 listings (DC, AC, BC, AX). Text1 should return the number 3 only if ComboBox1 <> DC and  Checkbox1 = ticked.

       

      The individual conditions on their own works. So the script below return a 3 in Text1

       

      if (this.getField("CheckBox1").value != "Off") {

          event.value = 0.03 ;

      } else {

      event.value = 0 ;

       

      While this also returns a 3 in Text 1

       

      if (this.getField("ComboBox1").value !="DC") {

          event.value = 0.03 ;

      } else {

      event.value = 0 ;

       

      However when I join them together the script fails 

       

      if ((this.getField("CheckBox1").value != "Off") && (this.getField("ComboBox1").value !="DC")) {

          event.value = 0.03 ;

      } else {

      event.value = 0 ;

       

      The problem would appear to be one of syntax but having spent much time looking at it can no longer see straight. What am I doing wrong? 

      Many thanks