2 Replies Latest reply on Jan 11, 2011 7:11 AM by c0rp535

    problem with conditional logic in acrobat JS

    c0rp535

      I am going crazy with what I think should be a simple conditional calculation routine..

       

      The fields on the form:  (fld8_ prefix).. so, fld8_1a, 2a, 3a and  Skip - so I've got 4 fields total to work with..

      field 3a is set to either the value of 1a or 2a, depending on checked state of the checkbox.

       

       

      var v1=getField("fld8_1a");

      var v2=getField("fld8_2a");


      if(this.getField("fld8Check_Skip").isBoxChecked(0)==true)

      {

          event.this=v2.value;

          app.alert("great, using 2a by force");

      }

      if(this.getField("fld8Check_Skip").isBoxChecked(0)==false)

      {

          if (v1.value>v2.value)

              {

              event.value=v2.value;

                  app.alert("using 2a by logic");

              }

          else

              {

              event.value=v1.value;

                  app.alert("using 1a by logic");

              }

      }

      So, using this code, the event.value is not getting set under the first condition.  My alert is popping up saying "using 2a by force", but the field just doesn't get set with the v2.value. 
      Please, someone tell me what stupid thing I'm doing.  I've spent HOURS looking on this site, google, etc., and I haven't found anything to clue me in on my problem.  I've tried MANY variationis of the if statement.  I've tried a simpler if/else, but that didn't really work.
      Also, I should add, the field calculation order seems to be ok - the fields are show as 1a, 2a, 3a - which is all correct.