2 Replies Latest reply on Jul 12, 2010 3:37 PM by Dablo_81

    What is wrong with my script?

    Dablo_81

      Hi,

      I am trying to complete a form in acrobat, but this is the first time I have ever used javascript.  Using this forums page, google (and my knowledge of Maths and excel), I have managed to write script for most of the calculations I am performing.  However, I am having trouble with the final calculation and would like someone to have a look and offer me some guidance on where I am going wrong.  Here is an overview of what I am trying to do, followed by the script:

       

      Overview. I want my calculation to look at the field value in one field (MandateType) and then based on that, look at the value of a second field (“Fund” in 1st field, it looks at FundPercen field, “Segregated” in 1st field, it looks at SegPercen field).  Then, based on the value in either FundPercen or SegPercen, my calculation field is to put one of three messages forward (accept, discuss, or fail).

       

      Code:

       

      if (this.getField("MandateType").value == Fund)

      {

      Event.value=(this.getField(“FundPercen”).value=

      {

      if (this.getField(“FundPercen”).value == =<0.7) {

      event.value=”overweight”;

      }

      Else if (this.getField(“FundPercen”).value == (=<0.475) && (=<0.7)) {

      event.value=”good weight”;

      }

      Else if (this.getField(“FundPercen”).value == >0.475) {

      event.value=”Reject”;

      }

      Else if (this.getField("MandateType").value == no)

      {

      Event.value=” “

      {

      Else if (this.getField("MandateType").value == )

      {

      Event.value=” “

      }

       

       

      Can someone tell me where I am going wrong?

      Many thanks

       

        • 1. Re: What is wrong with my script?
          gkaiseril MVP & Adobe Community Professional

          Are you getting any error messages when you try to save the script?

           

          Have you checked the spelling and capitalization of names?

           

          Alphabetic strings must be within quotes.

           

          Combo Boxes/List Boxes can not have a null value.

           

          You might want to RT*M for Acrobat JavaScript and Mozilla JavaScript.

          1 person found this helpful
          • 2. Re: What is wrong with my script?
            Dablo_81 Level 1

            Thanks GKaiseril for your help.  As a complete novice in JavaScript, I was aware that my Script was quite poor and therefore I decided to break down the calculations into several fields and pointed the fields where necessary rather than creating a long Script in just one field.  Although laborious, it got me the results I wanted.

             

            Thanks to everyone else that looked into helping me too.

             

            David