These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Disable auto-save

Runolfr
Registered: Oct 1 2008
Posts: 119
Answered

I've got a form that I developed with LiveCycle Designer and it seems to work fine except for one thing. When the user goes to close the form after submitting the data, there's a pop-up box that asks if they want to save changes.

There's no reason that my users should want to save the form with whatever values they entered in the controls; even if they did want to keep a copy of their own, they should have to specifically choose to do it from the menu.

Is there a way to disable the alert that asks if you want to save a changed file?

My Product Information:
LiveCycle Designer, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
I'm not sure if it will work with a Designer-created document, but you can try setting the "dirty" document property to false after the submit. By setting it to false, Acrobat will not consider that the document is in need of saving. The problem is if the user makes any changes after the submit takes place, the dirty property will get set to true again.

George
Runolfr
Registered: Oct 1 2008
Posts: 119
Doesn't seem to be working. Have I got the syntax right?

// Prevent save prompt
Doc.dirty = false;
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
That's probably not right. Exactly where did you place that code?

Try:

event.target.dirty = false;
George
Runolfr
Registered: Oct 1 2008
Posts: 119
George_Johnson wrote:
That's probably not right. Exactly where did you place that code?
It's in the click event of a button object.

I'll try your version.
Runolfr
Registered: Oct 1 2008
Posts: 119
event.target.dirty = false;

...didn't work. After a bit of consultation with the API reference, I also tried...

event.target.requiresFullSave = false;

...which didn't work either.
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Using:

event.target.dirty = false;

in a button click event works for me. Make sure it is the last line. Could the form be changing after this code is executed?

George
Runolfr
Registered: Oct 1 2008
Posts: 119
There shouldn't be anything changing after that. One of the things I did just before that point was switch all the controls access values to "protected", so it shouldn't even be possible for something to change after that.

The API reference says "If the document is temporary or newly created, setting dirty to false has no effect", so I'm wondering if that has something to do with it.
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
You document shold not be temporary or newly created.

What happens if after submitting you open the JavaScript console and execute:

dirty = false;


Is the data submitting to a server, or are you sending by email? If a server, what does the response from the server do?


George
Runolfr
Registered: Oct 1 2008
Posts: 119
The form is being sent by email. Here's the whole script.

 ReferralRequestForm.ReferralRequestPage1.Button1::click - (JavaScript, client) // Validate before continuingif (ReferralRequestForm.execValidate() == true) { // Verify submissionvar cMsg = "Are you sure you are ready to submit this form? \n\n"cMsg += "Select YES to LOCK the form and generate the email.\n\n"cMsg += "Do you want to Continue?\n\n"var nRtn = app.alert(cMsg,1,2, "Lock Form?"); if(nRtn == 4){ // A Yes Answer// Get the field containers from each page.for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {var oFields = xfa.layout.pageContent(nPageCount, "field");var nNodesLength = oFields.length;// Set the field property.for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {oFields.item(nNodeCount).access = "protected";}} // Specify email subject linevar eAddress = "<span class="spamspan"><span class="u">myname</span> [at] <span class="d">company [dot] com</span></span>";switch (ReferralInformation.Setting.rawValue) {case "Long-Term Care":eAddress = "<span class="spamspan"><span class="u">umltc</span> [at] <span class="d">company [dot] com</span></span>";break;case "Assisted Living":eAddress = "<span class="spamspan"><span class="u">umal</span> [at] <span class="d">company [dot] com</span></span>";break;default:eAddress = "<span class="spamspan"><span class="u">myname</span> [at] <span class="d">company [dot] com</span></span>";break;} // end eAddress switch //this.resolveNode("#event").submit.target = "mailto:" + eAddress + "?&subject=Routine/Specialty Referral, MemberID: " //										 + ReferralInformation.MemberID.rawValue; // Generate emailvar SubURL = "mailto:" + eAddress + "?&subject=Patient Referral Information, MemberID: " + ReferralInformation.MemberID.rawValue;event.target.submitForm({cURL: SubURL, cSubmitAs: "PDF"});// end of submit statement */   // Provide option to reopen the form for further requests regarding the same patient.cMsg = "Do you want to submit another request for this patient? \n\n"cMsg += "Select YES to CLEAR and UNLOCK the requested services fields for new entries.\n\n"cMsg += "Do you want to Continue?\n\n"nRtn = app.alert(cMsg,1,2, "Unlock Form?"); if(nRtn == 4) { // A Yes Answer // Unlock specific fields in the Requested Services and Clinical Information sectionClinicalInformation.RequestedServices.access = "open";ClinicalInformation.RequestedProvider.access = "open";ClinicalInformation.SupportingDiagnoses.access = "open";ClinicalInformation.ClinicalInformation.access = "open";ClinicalInformation.DiscussedWith.MedicalDirector.access = "open";ClinicalInformation.DiscussedWith.PC.access = "open";ClinicalInformation.DiscussedWith.RpFamily.access = "open";ClinicalInformation.CarePriority.access = "open"; // Clear content of unlocked fieldsClinicalInformation.RequestedServices.rawValue = null;ClinicalInformation.RequestedProvider.rawValue = null;ClinicalInformation.SupportingDiagnoses.rawValue = null;ClinicalInformation.ClinicalInformation.rawValue = null;ClinicalInformation.DiscussedWith.MedicalDirector.rawValue = 0;ClinicalInformation.DiscussedWith.PC.rawValue = 0;ClinicalInformation.DiscussedWith.RpFamily.rawValue = 0;ClinicalInformation.CarePriority.rawValue = null; // Unlock Submit buttonthis.access = "open"; }endif; // Unlock for another patient alert "Yes" }endif; // Lock and Send alert "Yes" // Prevent save promptevent.target.dirty = false;}else{cMsg = "Not all required fields contain valid information. \n\n"cMsg += "Check all form fields before re-trying."nRtn = app.alert(cMsg);}endif; // form validation TRUE
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
I don't understand your use of "endif". It should generate a runtime error and prevent any further code from executing, which may be part of your problem.

George
Runolfr
Registered: Oct 1 2008
Posts: 119
Apparently it was. I must be getting my languages mixed up.