1 Reply Latest reply on Feb 13, 2012 8:08 AM by Bernd Alheit

    Help with javascript

    MartinCox2805ACo

      Hi,

       

      Am new to Adobe script writing and need some help with a company wide form we use here at Marine Corps Communication-Electronics School.  I am a MircoSoft Access programmer with over 20 years of experience.  Any help with my problem will be greatly appreciated. 

       

      I am an electronic instructor and part of our job is to evaluate over instructors.  We have an Adobe Acrobat form that asks 49 questions.  The dropdown list allows the values of N/A, 1, 2, 3, 4, and 5 to be selected by the evaluator.  The problem is the final average field.  I have tried differnt things but everytime I try to write a javascript program to do the calculation, the field does not display anything. 

       

      I built a simple form that uses the same naming conventions as the final form.  It has 3 dropdown fields and a final avereage field. 

       

      Here is all the code that I have been playing with;

       

      int count;      //declare count as integer

      int totalcount;     //declare totalcount as integer

       

      count = 0;          //set count to 0

      totalcount = 0;    //set totalcount to 0

       

      totalcount = xfa.form.F.P1.DropDownList1.rawvalue + xfa.form.F.P1.DropDownList2.rawvalue + xfa.form.F.P1.DropDownList3.rawvalue;

       

      if (xfa.form.F.P1.DropDownList1.rawvalue > 0)  {

           count = count + 1;

      }

      if (xfa.form.F.P1.DropDownList2.rawvalue > 0)  {

           count = count + 1;

      }

      if (xfa.form.F.P1.DropDownList3.rawvalue > 0)  {

           count = count + 1;

      }

       

      this.rawValue = totalcount / count;

       

       

       

      I would have attached my file but I can't figure out how to do that. 

       

      any help from anyone would be greatly appreciated. 

       

      Thank you ahead of time.