4 Replies Latest reply on Oct 6, 2013 9:51 AM by Bribie4507

    If, Then, Else help needed, please.

    Bribie4507

      Hi,

       

      I'm working on a fillable pdf form.

       

      I've been OK, but now I've hit a problem trying to get an "If, then, else" problem.

       

      Here goes...

       

       

      I've got 2 Text boxes, "Step1" and "Step2".

       

      If the value in "Step1" is greater than, or equal to, 120, say 234

       

            then "True" will appear in "Step2"

       

      But, if the value in "Step1" is less than 120, say 56

       

            then "0", zero will appear in "Step2"

       

      Thanks for your help

        • 1. Re: If, Then, Else help needed, please.
          try67 MVP & Adobe Community Professional

          Have you read some JS tutorials? I recommend this one: http://w3schools.com/js/default.asp

          Just keep in mind that what you need to use is the core JS commands, not all the browser-related stuff...

           

          If you still need help afterwards, post here again and I'll help you out with the code.

          • 2. Re: If, Then, Else help needed, please.
            Bribie4507 Level 1

            Hi Gilad,

             

            Thank you for replying and with the suggestion of JS Tutorials.

             

            Honestly, I don't have the time at the moment to understand and do this myself, I've already wasted too much time "trial and error" and I'd really appreciated your solving the problem for me.

             

            As for the answer, can I cut n paste into the Acrobat "Custom Calculation Script" box?

             

            Also, how about script to change a number into "Weeks, Days and Hours"?

             

            Regards,

             

            Nigel

             

            Message was edited by: Bribie4507

            • 3. Re: If, Then, Else help needed, please.
              try67 MVP & Adobe Community Professional

              Custom calculation script for Step2:

               

              var step1 = this.getField("Step1").value;

              if (step1=="") event.value = "";

              else event.value = Number(step1) >=120 ? "True" : "0";

               

              I don't understand your last request about the "weeks, days and hours"... What kind of number are you talking about?

              • 4. Re: If, Then, Else help needed, please.
                Bribie4507 Level 1

                Thanks for that, I'm looking forward to giving it a try tomorrow with a clear head.

                 

                OK, the form is for working out course lengths, so the final calculation gives a number of hours.

                 

                The teaching week is 1 hour lessons, 6 lessons a day and 5 days a week, so a teaching week would be 30 hours.

                 

                So, if the final result is say, 100 hours, i'd like a further box to break that 100 hours down into 3 weeks (3x30=90), 1 day (1x6=6) and 4 hours.

                 

                Thanks again for your valuable assistance,

                 

                Nigel