Expand my Community achievements bar.

SaveAs removes rights enabled

Avatar

Former Community Member
I have an ARES enabled form that allows users to enter data then save the result data to a database via ODBC. I also use a TrustedFunction to save the pdf. Everything works fine except the saved pdf is nolonger enabled and all data fields are readonly and appear to have been flatten when opened in Reader.



Interestingly, when opened in Designer and previewed the fields are editable and the javascript works but the form is not enabled.
4 Replies

Avatar

Former Community Member
It's normal that it's all read only, in Reader when you open a form that has broken rights it automatically makes everything read only. When you open it in Designer it converts the PDF to an XDP so that's why it's no longer read only, it's also why opening it in Designer will strip the rights if save the PDF from there.



Now, are you sure it's saving the PDF that breaks the rights? In my experiance it's usually some script that changes the template that breaks it, but it appears like it's the save that does it until you dig deaper. For example, if you change the SQL query of the data connection and then save it will break because the template has been changed. You'd actually have to reset the properties you changed back to the original ones before saving.



Anyways, it's hard to tell you what could be doing it without going through the script on your form, but focusing on that would be my advice.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
Thanks Chris.

I did not realize the changing the SQL would be a template change. What other types of actions would constitute a template change? Better yet is there a method I could call to see if there has been a template change?



Rich Ruiz

Avatar

Former Community Member
No, there's no method that would tell you that. Normally it's pretty hard to do something to break the rights, but this situation is commonly bumped into. At least the work around is fairly simple to do. I can't send you the form I have it implemented on, but here's some script snippets. Basically I save the properties of the dataconnection in two variables in a preSave event and then reset them to the original values when the form was RE'd, then in the postSave event I reset them back to the values saved in the variables. This way the rights are still valid when the newly saved PDF is reopened.



In form:preSave:



xfa.form.form.variables.tempFCCmdType.value = xfa.sourceSet.formConnection.nodes.item(1).query.getAttribute("commandType");

xfa.form.form.variables.tempFCQuery.value = xfa.sourceSet.formConnection.nodes.item(1).query.nodes.item(0).value;



xfa.sourceSet.formConnection.nodes.item(1).query.setAttribute("table", "commandType");

xfa.sourceSet.formConnection.nodes.item(1).query.nodes.item(0).value = "form";



In form:postSave:



xfa.sourceSet.formConnection.nodes.item(1).query.setAttribute(xfa.form.form.variables.tempFCCmdType.value, "commandType");

xfa.sourceSet.formConnection.nodes.item(1).query.nodes.item(0).value = xfa.form.form.variables.tempFCQuery.value;



Of course in yoru case you'd have to change the values the being reset to so it matches whatever you had when you RE'd the form.



Hope that helps.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
Chris,

Sorry I should have posted sooner. I had already solved the problem doing pretty much what you suggested. I save the SQL values to script variables in the form init. Then after saving my data, restoring the SQL before saving the form with it's new name. That solved the rights issue.



I have another issue that would be better handled offline. Send me an email and I'll explain.



Rich Ruiz

rruiz@novanis.com