Expand my Community achievements bar.

SOLVED

AEM Forms: Designer MasterPage Issue

Avatar

Level 4

Hi Team,

 

I am trying to update a logic on the form, where i have "Hide" button on the Masterpage and  several other buttons on the content area for the page. The condition is when we click the "Hide" button on the Masterpage the rest of the buttons on the content page should be hidden and also the "Hide" button on the Masterpage should be hidden.

 

Currently when we click the button on Masterpage it is hiding all the buttons on the content area, but it is not hiding itself, can this be an issue related with the masterpage or since is focus is moving away from the Master page it is not able to hide itself.

 

Thank You

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi @pranaym48551345 , this is not an issue but works as designed.

Master page and Content pages work differently and are handled at different times in the event hierarchy. The feature of hiding a button upon pressing it will work on Content pages. Having a singular button on the Master page and hide itself on click will also work (although it makes no sense in this case). But the moment you are affecting other objects (buttons) in different context, the render engine will prevent this button from being removed from the active object hierarchy (which hiding it would do). 

You might consider using a hidden field which has initially 0 as value. When you press the Hide button you hide all other and set the field to 1. Henceforth you check that hiding only takes place when the field has 0? A very roundabout way to prevent actions on secondary press. If it is more about not having those buttons on the print version of the form you can use the "Visible (Screen Only)" Presence option on all buttons?

View solution in original post

3 Replies

Avatar

Employee Advisor

@pranaym48551345 It's best not to write this logic on master page and move the button to content area.

Avatar

Level 4

Hello,

Can you please tell us what might be causing this issue and is there a way to fix this issue maybe with some additional scripting.

Thanks

Avatar

Correct answer by
Employee

Hi @pranaym48551345 , this is not an issue but works as designed.

Master page and Content pages work differently and are handled at different times in the event hierarchy. The feature of hiding a button upon pressing it will work on Content pages. Having a singular button on the Master page and hide itself on click will also work (although it makes no sense in this case). But the moment you are affecting other objects (buttons) in different context, the render engine will prevent this button from being removed from the active object hierarchy (which hiding it would do). 

You might consider using a hidden field which has initially 0 as value. When you press the Hide button you hide all other and set the field to 1. Henceforth you check that hiding only takes place when the field has 0? A very roundabout way to prevent actions on secondary press. If it is more about not having those buttons on the print version of the form you can use the "Visible (Screen Only)" Presence option on all buttons?