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

The preSubmit for a Master Pages button fires multiple times.

Avatar

Level 1

I have coded the following JavaScript script in the preSubmit event for a submit button that will result in a database deletion.

form1.#pageSet[0].Page1.ButtonAreaTop.DeleteButton::preSubmit:form - (JavaScript, client)

 

var resp = xfa.host.messageBox("Delete this filing?","Verify",2,2);

if (resp == "4") { xfa.event.cancelAction = false;}

else { xfa.event.cancelAction = true;}

The script works, but because the button is on the Master Pages and the form has multiple pages, the preSubmit event is being invoked as many times as there are pages.  So, the user has to answer the same question multiple times.  This is a little annoying.

Does anyone have an idea on how I can keep the DeleteButton on the Master Pages and prevent the message box from appearing multiple times (once for every page)?

1 Accepted Solution

Avatar

Correct answer by
Level 8

Give this a try:

if (Page1.index==0){
var resp = xfa.host.messageBox("Delete this filing?","Verify",2,2);


if (resp == "4") { xfa.event.cancelAction = false;}


else { xfa.event.cancelAction = true;}
}

Kyle

View solution in original post

2 Replies

Avatar

Correct answer by
Level 8

Give this a try:

if (Page1.index==0){
var resp = xfa.host.messageBox("Delete this filing?","Verify",2,2);


if (resp == "4") { xfa.event.cancelAction = false;}


else { xfa.event.cancelAction = true;}
}

Kyle