This content has been marked as final. Show 5 replies
Hope this would help:
var MBox = xfa.host.messageBox("Are you sure you want to clear this form?", "Confirmation", 3,3);
if(MBox == 4)
// Clear form function.
The above will only work in a form created in LiveCycle Designer. Are you creating an XFA form or an AcroForm?
Actually, it works on XFA form and an AcroForm for me. But will try out on the Acrobat Reader 8.0 only PC. Thank you for mentioning.
It will work for a LiveCycle Designer form saved as a PDF. The code as written can not be placed in a script field in AcroForms as the 'XFA' object, 'host' object, and 'messageBox' object does not exist.
For coding for AcroForms one can use:
if (app.alert("Do you really want to clear all fields of the form?", 2, 3) == 4)
I recommend looping through all of the fields, and comparing their current value to their default value. Then only show the dialog if at least one of the fields has changed.