3 Replies Latest reply on May 22, 2013 7:48 AM by gkaiseril

    Combo Box Calculations

    Aman Habib Level 1

      Is there any way to use the drop down box or "combo box" with numbers in a calculation for another field.

       

      ex.  "Combo box1"= 500 , 1000, 2000 and "Text1" calculation should be "Combo box1 - 25"

       

      It doesn't seem to recognize the number in "Combo Box1" when I try to do this. Any help would be greatly appreciated!

       

      Thanks

        • 1. Re: Combo Box Calculations
          gkaiseril MVP & Adobe Community Professional

          What calculation option are you using?

           

          What code are you using?

           

          What do you mean by "does not recognize"?

           

          If you are using "Simplified field notation" you should not have spaces in your field names, unless you use the special escape character to make the space within the field name to be treated as part of the field name.

           

          Have you accounted for the case of no selection made?

           

          Have you looked at what the type of the value is from the combo box?

           

          Do you understand the 2 different ways that the "+" operator works with JavaScript?

           

          Can you provide any JavaScript console messages?

           

          Can you link to a sample form?

          • 2. Re: Combo Box Calculations
            Aman Habib Level 1

            Im using a "simplified field notation". The field that im calculating (Text1) is showing up as a blank field. There are no spaces in the field names. I unfourntunatly have no clue about anything with JavaScript. All the values in the Combo box are numbers so i expected the calculation to work fine. I want the calculation to be-  Combobox1 - 25

            • 3. Re: Combo Box Calculations
              gkaiseril MVP & Adobe Community Professional

              Are you sure there is not an error elsewhere or your calculation order is correct?

               

              "Combo Box1" has a space in the name. What exactly is the name of your "Combo Box1" field?

               

              Using the following code:

               

              Combo Box1 - 25

               

              The error is:

               

              SyntaxError: missing ; before statement

              2:Field:Calculate

               

              Using the following code:

               

              Combo\ Box1 - 25

               

              produces an answer.

               

              Also spelling and capitalization of field names is very important.

               

              Please post a link to a sample form with the problem.