Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Alert Message with Yes/No

Avatar

Former Community Member

I need the "No" button to cancel the removal of the subform.

The Yes button works, here is my script:

_Subform1.removeInstance(Subform1.count
- 1);

// Prompt the user 

var nResponse =
xfa.host.messageBox("You are about to remove a program. \n\nDo you
want to continue?", "Removing a
program?", 2, 2) 

 

// Test the response: Yes = 4 

if (nResponse == 4)

}

1 Reply

Avatar

Level 10

Hi,

Can you change the approach to only call the removeInstance once the Yes button has been selected.

// Prompt the user 

var nResponse = xfa.host.messageBox("You are about to remove a program. \n\nDo you want to continue?", "Removing a program?", 2, 2) 

 

// Test the response: Yes = 4 

if (nResponse == 4)

     _Subform1.removeInstance(Subform1.count - 1);

}

Regards

Bruce