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

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments
Adobe Summit 2023 | Complete list of AEM Sessions & Labs
SOLVED

Text object visibility?

Avatar

Level 8

Hello

I knew that its odd, but just want to chk with experts that do we hava any chance to make visible/hide a text object DYNAMICALLY?

I put a text object, i want to change its visibility dunamically, i mean, i have a flag, i will use it in JS to determine the visibility of this text object, pls. let me know is it possible? if so, JS code anippet pls. ?

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 10

Ah, I see what you mean. You would have to run the script elsewhere - what triggers the decision to show or hide the text? Put the script there.

Or you could put the text object into a subform and control the presence via the subform.

View solution in original post

0 Replies

Avatar

Level 10

A simple if statement should do it. Unless I'm not understanding what you're after.

if (flag == show) {

     textobject.presence = "visible";

}

else if (flag == hide) {

     textobject.presence = "hidden";

}

Avatar

Level 8

Right, my original posting is not clear/understandable, Sorry

I am asking about the below TEXT (Tax Information) changing the visibility DYNAMICALLY, which can determinaed by my_own_flag

100.jpg

Pls. help me is it possible to change its visibility dynamically? if so, JS pls?

Thank you

Avatar

Level 10

A text object acts like any other for hiding or showing.

The code I showed previously using the .presence method controls visibility.

Avatar

Level 8

Thank you, but where should i put this code, bcz all events are greyed for this TEXT!

If i want to put at root (say my_form) level, then, how can i tell to the system that to make the TAX INFORMATION text as hide/visible? bcz this TAX INFORMATION textObject doesn't have any NAME to it right?

Thank yoiu

Avatar

Correct answer by
Level 10

Ah, I see what you mean. You would have to run the script elsewhere - what triggers the decision to show or hide the text? Put the script there.

Or you could put the text object into a subform and control the presence via the subform.