if, then form calculations...stumped

Ask a Question related to Adobe Acrobat Macintosh, Design and Development.

  1. #1

    Default if, then form calculations...stumped

    I'm working with a financial application form. I have the following fields:
    "number of loans"
    "new loan set up"

    My client wants a calculation in the "new loan set up" that would multiply the "number of loans" field by "150" and determine if the sum is lower than "637.50" then the value is "0" or if the value of the sum is greater then the amount would equal the sum.
    I have a hidden field "loans multiplied" that uses a calculation to multiply "number of loans" by "150"
    here is the script:
    var a = this.getField("number of loans")
    event.value = (a.value*150)

    Below is what I put together, but I'm a designer, not a "script-tease" Somebody please help me!

    var a = this.getField("loans multiplied");

    {
    if(a.value <= "637.50") event.value = "0"; else if(a.value >= "637.50")
    event.value = a.value;
    }
    Joel_Dryden@adobeforums.com Guest

  2. Similar Questions and Discussions

    1. Calculations in a form
      Forgive me, but I'm new at this. I was given an excell file to place in Acrobat to create a form. There are two colums that will have numbers in...
    2. Editing Existing Form with Calculations
      Hi, A previous designer built an order form calculating subtotals and totals from user-entered data. I wanted to add one more radio button set,...
    3. Date calculations from FORM field
      Hello everyone, I am trying to build a site for my company that to replace our current leave request database. This is how I would like the site...
    4. Form Design with numeric calculations
      Am new to Flash! Am trying to design a form that will allow user input for general information, selection of items, sub-totaling and totaling of...
    5. Could someone have a look at my .fla please. I'm stumped!
      Okay firstly heres the .swf of what im trying to do http://www.happylobster.co.uk/flash/flashtester.swf Basically I have 2 Scenes, each with a...
  3. #2

    Default Re: if, then form calculations...stumped

    Remove the quotes around the values:


    if (a.value < 637.50) event.value = 0;

    else event.value > 637.50;


    With the quotes, the values are being compared as strings, not numbers like you want. And there is no need for the opening and closing curly braces for this block of code.

    It sounds like you're muliplying two integers (number of loans * 150), so the result will never be equal to 637.5, so the above code should work.

    You may not need to have that intermediate calculated field at all, and simply change the code to:


    var v1 = 150 * getField("number of loans").value;

    if (v1 < 637.5) event.value = 0;

    else event.value = v1;


    George
    George_Johnson@adobeforums.com Guest

  4. #3

    Default Re: if, then form calculations...stumped

    Works, Thanks George!
    Joel_Dryden@adobeforums.com Guest

  5. #4

    Default Re: if, then form calculations...stumped

    BTW, that should have been:




    if (a.value < 637.50) event.value = 0;

    else event.value = a.value;


    George_Johnson@adobeforums.com Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139