Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How can I add a page conditionally?

Avatar

Level 2

Good Morning,

I am trying to find a way to conditionally add a page to my form. I have attempted to create this as a result of an 'action' but have been unsuccessful in locating the correct action.

To summarize, I am trying to add a separate page to my existing form containing instructions when a specific checkbox is selected. The seperate page is text only and does not have any form/field inputs. Is there a relatively simple way to accomplish this task?

1 Accepted Solution

Avatar

Correct answer by
Level 7

You can enter the code in the script editor. If you don't have it showing you can get it by pressing (on a PC) Ctrl+Shift+F5.

View solution in original post

5 Replies

Avatar

Level 7

you could just have the page there but set to hidden and then when the checkbox is checked it is set to visible. You could put something like this in the change event of the checkbox (in formcalc):

if ($ == 1) then

otherpage.presence = "visible"

else otherpage.presence = "hidden"

endif

Avatar

Level 2

Awesome! Thanks for the input, I will try that out.

Avatar

Level 2

I hate to ask (what I imagine) are stupid questions, but I'm not really sure how to go about entering the script you offered. I was originally thinking that I would find a place to put the script in the object properties (Field, Value or Binding), but I don't see an appropriate place. Is this something I should enter directly as XML? I didn't see any options for how the form handles the change event either.

I appreciate your time and response.

Avatar

Correct answer by
Level 7

You can enter the code in the script editor. If you don't have it showing you can get it by pressing (on a PC) Ctrl+Shift+F5.

Avatar

Level 2

Wow, I never knew that was there! Thank you for the advice, I appreciate it.