Expand my Community achievements bar.

SOLVED

How to show/hide button depending upon the panel.

Avatar

Level 4

Hi!
I'm new to AEM forms & working on one where I have 3-4 different panels/tabs. I want to show my submit button in last tab only & hide it in rest panels. 
So can you please tell me how can I achieve this?

1 Accepted Solution

Avatar

Correct answer by
Level 5

Try this in the Submit - Navigation rule:

this.visible = !this.panel.navigationContext.hasNextItem;

With the "Hide Object" property of the button checked, so it is hidden when form opens.

View solution in original post

4 Replies

Avatar

Employee Advisor

@sesmic 

You can keep the submit button disabled/hidden in the toolbar, and for the last panel, on initialize/show, you can show /enable the Submit button.

Let me know if you're stuck anywhere.

Avatar

Level 4

Thanks for the reply!
But how can I keep the submit button hidden in toolbar? There are other button also (reset, next)
As for the panel only initialize is there. "When initialize Panel & then hide/disable Submit button" is set, button is shown as well as disabled in every panel. Can't figure it out.

Avatar

Correct answer by
Level 5

Try this in the Submit - Navigation rule:

this.visible = !this.panel.navigationContext.hasNextItem;

With the "Hide Object" property of the button checked, so it is hidden when form opens.

Avatar

Level 4

Hi! Thanks for the reply.
I did like you mentioned & this worked! Please check once if its the correct way.

sesmic_0-1663133897216.png

Also, can you please explain what this line does?

this.visible = !this.panel.navigationContext.hasNextItem;

Thanks again!