Trying to have a button set the value of a field based on multiple true/false conditions on the form. The script appears to run correctly as shown in the attached image. But it does not put any value in the targeted field. Basically the user identifies the regular price of the item, selects if it was on sale, the sale price, if there was any discount, the discount amount. The user then clicks on the button to set the Purchase Price.
The following is the script I have:
The 'Edit click handler' is set as follows:
- Action = Control component
- Component = purchase_ticket_price (Number Input)
- Method = Set value
- Value = if ( {{ on_sale.value }} = true & {{ discount.value }} = true) { {{ price_sale.value }} - {{ discount_amount.value }}; }
else if ( {{ on_sale.value }} = true & {{ discount.value }} = false ) { {{ price_sale.value }};}
else if ( {{ on_sale.value }} = false & {{ discount.value }} = true ) { {{ price_regular.value }} - {{ discount_amount.value }}; }
else { {{ price_regular.value }}; }
This is what is shown in the box below the script:
"if ( true = true & true = true) { 90 - 3; } else if ( true = true & true = false ) { 90;} else if ( true = false & true = true) { 103 - 3; } else { 103; }"
Advance Options are empty.
If I change the Component to a Text Input then it inserts the 'if (true =...' line but not the value.
I figure I'm likely missing something or did something wrong.
Help!
Please!