1 Reply Latest reply on Jul 10, 2014 9:48 PM by MichaelN

    Need help with a simple calculation.

    Houkie Level 1

      I will apologize up front. I have no knowledge of writing Javascripts. I can use them if somebody writes them for me, but that's it. I've created a simple form dealing with money. I have different text boxes for the user to enter a number based on what type of currency it is. Currency.jpg

      In the left column, they will enter a number. I would like for the right column to be calculated from that. However, the currency amount (ie. 100, 50, 20, etc) isn't a text field. It is simply text that entered in another program. What I'm looking for is a way to do this without having to make the currency amounts a text field. Something along the lines of X*100=.

       

      If you can give any help or suggestions, I would greatly appreciate it.

       

      Thanks.

        • 1. Re: Need help with a simple calculation.
          MichaelN Level 3

          You will have to hard code the currency amount into the script.

           

          In the first line, create 2 text fields, Text1 and Text2. Use this as the custom calculation script for Text2:


          if(this.getField("Text1").value !==""){
          event.value = this.getField("Text1").value * 100; 
          }

           

          //Clears Text2 if nothing is in Text1
          else event.value = ""

           

           

          The second pair of text fields would have "50" instead of "100" in line 2, etc.