Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Button Hide / Unhide Sequence

Avatar

Level 3

I have a series of three buttons A, B, C on a form.

When the form is first opened I need only button A to be visible (B & C both hidden).

Once A has been clicked, I need B to become visible (A & C both hidden).

Once B has been clicked, I need C to become visible (A & B both hidden).

Any help with this issue is greatly appreciated.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

I suspect the problem is that the email submit is being processed before the button presence script has fired. This means that the form is saved and attached to an email without the button changes. Try swapping the script around so that the presence of the buttons; and saving the file are dealt with before the submit script is fired.

You could split the total into two buttons (one hidden). The visible button could deal with the button presence; save the form; and call the click event of the hidden button (which would have the submit by email script).

Stefan Cameron has examples of two-button submits on his blog and I know that Paul has also posted different submit options (can't locate where).

Alternatively if you want to deal with one button, you could separate the two functions (button presence AND submit) into two different events of the same button; e.g. presence in the mouseUp and submit in the click event. This would need a bit of testing...

Also check that you have are preserving the script changes (in the File / Form Properties / Defaults tab):

08-09-2009 21-22-54.png

Good luck,

Niall

View solution in original post

4 Replies

Avatar

Level 10

Hi,

You can achieve this with the "presence" script. Using this script gives you three choices "visible"; "invisible"; and "hidden". The first two are obvious, hidden is like invisible, but it also excludes the object from the layout (so in a flowed form, objects beneath the hidden object would move up to take its place).

Button A javascript in the click event would look like:

// your own script - what the button does...

this.presence = "hidden"; // hides this button

buttonB.presence = "visible";

buttonC.presence = "hidden";

The script for the other buttons would be similar.

Hope that helps,

Niall

Avatar

Level 3

Before adding other click events the sequence works perfectly.

However, I am using the buttons as a email submit sequence.  And while the first submit works when it gets to the second user, who needs the second submit, the first one has reappeared.

Suggestions?

Thanks.

Avatar

Correct answer by
Level 10

Hi,

I suspect the problem is that the email submit is being processed before the button presence script has fired. This means that the form is saved and attached to an email without the button changes. Try swapping the script around so that the presence of the buttons; and saving the file are dealt with before the submit script is fired.

You could split the total into two buttons (one hidden). The visible button could deal with the button presence; save the form; and call the click event of the hidden button (which would have the submit by email script).

Stefan Cameron has examples of two-button submits on his blog and I know that Paul has also posted different submit options (can't locate where).

Alternatively if you want to deal with one button, you could separate the two functions (button presence AND submit) into two different events of the same button; e.g. presence in the mouseUp and submit in the click event. This would need a bit of testing...

Also check that you have are preserving the script changes (in the File / Form Properties / Defaults tab):

08-09-2009 21-22-54.png

Good luck,

Niall

Avatar

Level 3

Scripting Changes were not being preserved.  Problem solved and works perfectly.

Thanks again for you help.