2 Replies Latest reply: Aug 1, 2012 12:15 PM by govrellic RSS

    How to change currency symbol and calculation depending on checkbox?

    govrellic

      I am constructing a packing slip form with simple calculations, Quantity  x  Unit = SubTotal, but i need the calculation and the currency symbol to change depending on which radio box is chosen, USD or Yen (USD has decimal point where as the Yen does not).

       

      Is there a simple javascript?

       

      I use Acrobat9 pro

        • 1. Re: How to change currency symbol and calculation depending on checkbox?
          George_Johnson ACP/MVPs

          Sure. You have to create a document-level JavaScript and add to it a function like the following:

           

          function dollar_yenFormat() {

           

              // Get the value of the radio button

              var curr = getField("currency").value;

           

              // Determine the number of decimal places

              var nd = curr === "Yen" ? 0 : 2;

           

              // Determine the currency symbol

              var cs = curr === "Yen" ? "\u00a5" : "\u0024";

           

              // Set the format options

              AFNumber_Format(nd, 0, 0, 0, cs, true);

           

          }

           

          Replace "currency" with the actual name of the radio button group, and set the export value (Radio Button Choice) to "Yen" for the Yen radio button.

           

          Now you can set the custom Format script for the SubTotal field to the following:

           

          // Custom Format script for SubTotal field

          dollar_yenFormat();

           

          You can do the same for the grand total field or any other that need this.

          • 2. Re: How to change currency symbol and calculation depending on checkbox?
            govrellic Community Member

            Hi George,

             

            Thank you so much, the script works perfectly!

             

             

            [edited by forum host - email signature removed]