Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Setting up a toggle button where the caption changes when clicked

Avatar

Level 5

Good day all;

I am designing a new form and I am trying to figure out how to use 1 button to either display a field or hide a field.

What I am looking for exactly is the following.

A button that will default with the caption “Hide Field X” when the form is opened (and Field X is visible). When the user clicks on this button, “Field X” is hidden and the caption on the button changes to “Display Field X”. When the user clicks on this button “Field X” is displayed and the caption on the button changes to “Hide Field X”. I guess what I am looking for is a toggle switch with a caption change depending on “Field X” Presence.

Thanks for any suggestions

Chomp

1 Reply

Avatar

Level 10

Hi Chomp,

If you have a look at the Edit button Table 5 it will show how to change the caption of the button: http://assure.ly/gk8Q7a.

Niall