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
BedrockMission!

Learn more

View all

Sign in to view all badges

How do I code conditional text?

kkoenen
Level 1
Level 1

I have a form that needs to display Text Block 1 only if the "Total" is up to $499.99." If $500 or greater, I need to hide Text Block 1 and show Text Block 2.

Is there any way I can do this?

Thanks.

2 Replies
radzmar
Level 10
Level 10

Assuming your text blocks are different text objects and total is a numerice field, you can use a script in the total field calculate event.

FormCalc:


if ($ lt 500) then


    textBlock1.presence = "visible"


    textBlock2.presence = "hidden"


else


    textBlock1.presence = "hidden"


    textBlock2.presence = "visible"


endif


JavaScript:



textBlock1.presence = this.rawValue < 500 ? "visible" : "hidden";


textBlock2.presence = this.rawValue < 500 ? "hidden" : "visible



";


kkoenen
Level 1
Level 1

Beautiful!  That is just what I needed.

Thanks so much for taking the time to respond.

Katy