Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How can I supress the "Save" changes dialogue box when exiting a Reader extended form?

Avatar

Former Community Member

I have created an Adobe Reader extended form.  When the form has been completed and printed I do not want the end user to be able to save the changes and over write the original file.  How can I supress the "Save" changes dialogue box that pops up when the user closes the form?

3 Replies

Avatar

Level 10

Hi,

you have to set the dirty flag from true to false.

This can be done with a small script in a buttons click event or with a function.

var MyDoc = event.target;
MyDoc.dirty = false;

Here's an example form.

It has buttons that are highlighted with different color.

To suppress the save changes dialog every button triggers a function to check if the dirty flag was true before the button color changes.

If not, it will execute the sript above to "reset" the dirty flag so you can close the form without the save prompt.

http://thelivecycle.blogspot.com/2009/11/control-appearance-of-save-changes.html

Avatar

Former Community Member

Thank you very much for your response!  The form I have create is really made up multiple sub-form with actions that make the sub-forms enabled or disabled, visible or invisible depending upon what the user selects to do.  I have a two buttons currently on each sub-form, one is a Print button the completed form and the other button takes the end user back to the first page of the form.  The button that takes the user back is supposed to reset all the fields and go back to the first page.  But even if I click that button and go back to the first page and then click to close the form I still get the request to save changes.  Should I be able to add the code that you suggested to either button to gain the desired response?  Or could I add the code to a docClose event?

Here is the code from the click event for the "Print" button.

form1.#subform[0].CancelEnrollment.PrintButton1_CE::click - (JavaScript, client)

xfa.host.print(1

, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);

===========================================

Here is the code from the click event for the "BackToStart" button.

form1.#subform[0].Enrollment.BackToStart_ME::click - (JavaScript, client)

//+ GENERATED - DO NOT EDIT (ID:5F8BEEFE-92E8-4B16-825F-704E6E8E58E6 CRC:3044724234)

//+ Type: Action

//+ Result4: SetPresence("$Node3","invisible")

//+ Result3: SetEnabled("$Node3","readOnly")

//+ Result2: ResetForm()

//+ Result1: SetPresence("$Node2","visible")

//+ Node3: form1[0].#subform[0].Enrollment[0]

//+ Node2: form1[0].#subform[0].Welcome[0]

//+ Node1: form1[0].#subform[0].Enrollment[0].BackToStart_ME[0]

//+ Condition1: Button("$Node1","click")

//+ ActionName: BackToStart_ME

this.resolveNode("Welcome").presence

= "visible";

xfa.host.resetData();

oTargetField

= this.resolveNode("Enrollment");

oTargetField.access

= "readOnly";

this.resolveNode("Enrollment").presence

= "invisible";

//-

Thank you again!

Avatar

Level 10

Hi,

when you look into my sample, you will see that the script for the dirty flag is triggered by a timeout script.

It's because the app needs some time to render the layout, especially when you do things with sumbforms or calculation scripts.

So, when the script is executed to early, it has no effect.

In my sample form I used a timeout from 50 milliseconds, but you may need a higher delay such as 250 milliseconds on larger forms.

You can find the whole script under the exit:event of button 2.

app.setTimeOut('xfa.form.resolveNode("form1.#subform.CleanForm").execEvent("click");', 50);