5 Replies Latest reply on Jun 23, 2014 1:13 AM by MICWAR

    Checkbox change value in field and reveal hidden text

    MICWAR

      Hi

      I need to change a value in a field when a checkbox is pressed

      the default value could be 10$ in "formfield1"

      But when the checbox is checked the value in "formfield1" should change to 8$

      I also need a function to reval text in "textfield2" from hidden to visible text.

      Is that even possible to combine in one checkbox?

      I found some code  in the forum and modified it but it does not work as expected, it affects field it should not and it behaves a bit funny, below is the code to calculate.

      Also i tried to change the value from Off to On, but that didnt reversed the procedure as i hoped.

      Well Its a start, maybe someone can figure it out an give me some help on the way?

       

      ________________________________

      // custom calculation for discount

      var nDiscount = 2;

      // sub total field name

      var cSubTotal = "formfield1";

      // non-Discount check box name

      var cbNonDiscount = "CheckBox1";

      // set default value for non-Discount

      event.value = 10;

      // see if purchase is with Discount or not non-Discount

      if(this.getField(cbNonDiscount).value == "Off") {

      event.value = this.getField(cSubTotal).value - nDiscount;

      }

      // end custom calculating