459,528 Members | 1,345 Online
Need help? Post your question and get tips & solutions from a community of 459,528 IT Pros & Developers. It's quick & easy.

# Adobe LiveCycle Designer scripting problems

 P: 3 Using Adobe LiveCycle Designer, I can't get the script below to work using "formcalc" (a type of Javascript). I use this to calculate shipping costs for car club items by their weight in a pdf form. I'm only able to get the correct postage for the weights in lines 3,5 and 7 below. If I select an item that weighs between 0.11 and 0.25, the form calculates it as 2.25 instead of 1.90. Also, if the item weighs 2.51 or more, it only calculates it as 7.00 instead of 9.00. Expand|Select|Wrap|Line Numbers                 if        (ShpWt >= 0.01 <= 0.10) then               PostageSH = 1.90         elseif  (ShpWt >= 0.11 <= 0.25) then               PostageS = 2.25         elseif  (ShpWt>= 0.26 <= 0.75) then               PostageSH = 4.00         elseif  (ShpWt > 0.76 <= 2.50) then             PostageSH = 7.00         elseif  (ShpWt >= 2.51) then             PostageSH = 9.00         endif   Please suggest any script changes that will calculate the postage as illustrated. Thanks in advance, Mike Mar 4 '10 #1

according to the FormCalc-reference a correct if-statement with a logical AND should look like:

Expand|Select|Wrap|Line Numbers
1. if ( ShpWt >= 0.01 & ShpWt <= 0.10 ) then
2.     ...
3. elseif ...
4.
kind regards

5 Replies

 P: 86 elseif, then and endif don't exist in javascript. Also you forgot the logical OR operator (||) in your if statements and the second part of your if statements doesn't make sense unless you restate the variable you're comparing (in your case, ShpWt). Mar 5 '10 #2

 Expert Mod 5K+ P: 5,390 according to the FormCalc-reference a correct if-statement with a logical AND should look like: Expand|Select|Wrap|Line Numbers if ( ShpWt >= 0.01 & ShpWt <= 0.10 ) then     ... elseif ...   kind regards Mar 5 '10 #3

 P: 3 Thank you for posting the sample FormCalc script reference. That was just the bit of information I needed to get my form to work properly. Mar 8 '10 #4

 P: 3 For anyone else having a similar question regarding FormCalc, here is the final scripting that worked for me: Expand|Select|Wrap|Line Numbers     if ( ShpWt == 0 ) then         PostageSH = 0.00      elseif ( ShpWt >= 0.01 & ShpWt <= 0.10 ) then            PostageSH = 1.90         elseif ( ShpWt >= 0.11 & ShpWt <= 0.25 ) then                                     PostageSH = 2.25                  elseif ( ShpWt >= 0.26 & ShpWt <= 0.75 ) then                                    PostageSH = 4.00           elseif ( ShpWt >= 0.76 & ShpWt <= 2.50 ) then                                    PostageSH = 7.00      elseif ( ShpWt >= 2.51 ) then                                   PostageSH = 9.00          elseif ( ShpWt == 0 ) then                    PostageSH = 0.00      endif Mar 8 '10 #5

 Expert Mod 5K+ P: 5,390 Thank you for posting the sample FormCalc script reference. That was just the bit of information I needed to get my form to work properly. no problem ... even when it was no JavaScript question :) ... glad to hear that you got it working now :) kind regards Mar 8 '10 #6