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

Alertbox on submit email if a subform is visible

Avatar

Former Community Member

Hello,

I'm trying to create a script that would show a alertbox reminding the user that he must join needed files to the email before sending it. But this message must only be shown if a specific subform is visible, if it is not, than it must tranfer to the email directly.

I'm using the Lc subit by email button that is standard in Lc ES2 and I've been meddling around and I can't find a script for my probleme. I've used the general alertapp. but I really need the message to appear only if my subform is visible.. Hoping someone can help me with this. Thanks in advance for all your help.

Melanie

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

you can use a script in the preSubmit event of your Mail button.

It will check the visibility of you subform and prompt a message if it is visible.

form1.#subform[0].EmailSubmitButton1::preSubmit:form - (JavaScript, client)

if (Subform1.presence == "visible") {

        // Show a warning message

          xfa.host.messageBox("STOP");

        // Cancel the submit process

          xfa.event.cancelAction = true;

}

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

you can use a script in the preSubmit event of your Mail button.

It will check the visibility of you subform and prompt a message if it is visible.

form1.#subform[0].EmailSubmitButton1::preSubmit:form - (JavaScript, client)

if (Subform1.presence == "visible") {

        // Show a warning message

          xfa.host.messageBox("STOP");

        // Cancel the submit process

          xfa.event.cancelAction = true;

}

Avatar

Former Community Member

Thank you so much for your help! It works great!! Had only to place it in the subform cauz for some reason, on the submit button it didn't wanna work..

Thanks again for you quick help!!