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

Livecycle Designer - Checkbox Java "If" Statment - Box won't uncheck

bjohnson17
Level 2
Level 2


Hello,

I am writing a simple form with two numeric fields and a checkbox. What I want to happen is when the user selects the CheckBox, the value of the first numeric field (purprice) is copied to the second numeric field (purpriceB). When the box is un-checked, the value in the second numebric field should return to null or 0.

Here is my statement. I placed it in the "Click" event of the checkbox (Java):

if(this.rawValue=1)

{purpriceB.rawValue=purprice.rawValue}

else if

(this.rawValue=0)

{purpriceB.rawValue=0}

The form works right on the first click by coping the 1st value to the 2nd field, but won't allow me t o uncheck the checkbox after it has been checked the first time.

2 Replies
Anonymous
Not applicable

Hi,
Please try the following code.
I think this code can be solved your problem.
In the Click event of the CheckBox :
if (purprice.rawValue != purpriceB.rawValue)
{
purpriceB.rawValue = purprice.rawValue;
}
else
{
purpriceB.rawValue = 0;
this.rawValue = 0;
}
I hope this help 🙂
**S,Candy**

Magus069
Level 10
Level 10

Don't forget in your if statement you only have 1 '=' which means you are assigning a value to the field in the if statement..

to verify a if statement you must use '==' or '===', and to verify if it is different you can use '!=' or '!=='