Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Creating "if then" statements for a "promo code"

Avatar

Level 2

Hi,

Currently I have numerous CheckBoxes that all have associated values (lets say 50, 100, 200) and I have a NumericalBox that sums the selected CheckBoxes by using the FormCalc code "Sum(CheckBox1,CheckBox2......)

That works great, but now I want to have conditions on the code by using "if then statements" or something of the sort.  For example, can I have a TextField and when certain values are entered into the TextField there are effects on the NumericalBox?

So potentially,

if raw.value of TextField1 = "discount" 

then NumericalBox1 subtract 50

If I could do this all in FormCalc that would be great because it is much faster than Javascript.

Thank you

1 Reply

Avatar

Level 10

Did you try this..

if (TextField1.rawValue == "discount")then

     NumericField1.rawValue =  NumericField1-50;

endif;

Thanks

Srini