Quantcast
Channel: Adobe Community : Discussion List - LiveCycle Forms
Viewing all articles
Browse latest Browse all 1160

Field Validation based off another field

$
0
0

I have a form that is near completion with only one exception using formcalc. I am having the most terrible time figuring this out.

 

In my form I have three fields: SpecialPromotion (number field), BrandDiscount (calculated-readonly, number field), and DiscType (dropdownlist).

 

DiscType and BrandDiscount are linked by the DiscType. If DiscType is "BWI" then BrandDiscount calculates discount off gross amount. If it equals "N/A" then BrandDiscount is zero (blank).

 

If a user enters a dollar amount higher than 0 in SpecialPromotion, then BrandDiscount is zero (blank) and DiscType equals "N/A". If the user selects a different option in Disctype then SpecialPromotion should zero out (blank).

 

Basically, if SpecialPromotion has a value then BrandDiscount does not apply and/or vice versa.

 

Currently, I have this as a validate script in formcalc but it is not working and I continually get a validation error. Please any help or suggestion would be very appreciated. Thank you in advance.

 

Here is the coding I have so far:

 

if (SpecialPromotion > 0) then
BrandDiscount = 0; &
DiscType = "N/A";
endif

 

if (DiscType == "BWI") then
SpecialPromotion = 0;
elseif (DiscType == "HIL") then
     SpecialPromotion = 0;
elseif (DiscType == "HAM") then
  SpecialPromotion = 0;
elseif (DiscType == "MAR") then
  SpecialPromotion = 0;
elseif (DiscType == "HYT") then
SpecialPromotion = 0;
elseif (DiscType == "SWD") then
SpecialPromotion = 0;
elseif (DiscType == " ") then
SpecialPromotion = 0;
endif


Viewing all articles
Browse latest Browse all 1160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>