I posted it on this thread
paul
I would really like to get a copy of this script and directions on
where to place it in the XML language.
Ultimately I would like the fillable pdf form I created to be locked after a person fills it in and emails it back using the submit button, so that I receive a pdf with no fillable form fields.
Thank you
Would you mind sending me that script aswell to wilenco@gmail.com that would be appreciated
Hi Paul,
I have just sent you a PM with a link to my form, and am hoping that you may be able to assist me?
I really need to use this lockdown all fields, but am getting strange results...
I made a test form to try this on, and it all worked as it should.
I then tried to add it, to the "live" form that I am working on, but it only locked the first page.
I then added extra lines to the click even of the button, specifying the other pages in my form.
This appeared to work. You can populate the form and then click the button to lock all the fields.
The fields all lock. If you then save the form, and re-open it, all the fields are editable again, and are not read only?
Any help greatly appreciated.
Thanks
Hi Paul,
I read about you sharing the script for saving fillable form as a non-fillable pdf. Could you also send me the script? mine.tang@gmail.com
Do I need the LiveCycle Designer ES to create this script or will LiveCycle Designer 8 work?
Thank-you.
Hi Paul,
I'm new to this forum. And i've read the entire thread. I also need help on our Department's application form to be locked. Our form includes a date that automatically generates the current date and time everytime it is opened. My problem is that when the form is submitted to me through email, when I open it, it will still generate the current time I recieve it, and not when it was submitted. Does the script works on locking with that as well?
And also, i'm having problems viewing the script. Where can I view it? And where should I copy paste it? I'm using Adobe Acrobat 9 Pro and I also have the Adobe LiveCycle Designer 8.2.
I hope you can help me with this. I'm such a newb but I really need to get this done. And I'm willing to learn anything.
Thanks!
P.S. I was going to attach the document so you can take a look at it but i didn't see an option to attach a file.
fiel2003,
There is nothig attached. The locking of the fields that is in that script only stops the users from interacting with the field. Any scritp scan still access the fields. I think that you will want to wrap your code around a test to see if th efield is populated already. If it is then you know that the date was already set. Something like this:
if (this.rawValue == null) {
execute your code to populate the field
}
The script is in a scripting object called myScriptObject in the sample that is provided. There is a function in that scripting object called LockAllFields that has the code that you are after.
paul
If I need to exclude a button from locking, where abouts would I put the following code: MailButton.access = "open";
function LockAllFields(myParentObject){
var allChildElements;
var intNumElements;
var currentElement;
var j;
//Get all the child nodes of the parent element
allChildElements = myParentObject.nodes;
//Total number of element in the object
intNumElements = allChildElements.length;
//Loop through all the child elements
for(j=0; j< intNumElements;j++){
currentElement = allChildElements.item(j);
//If the element is another subform we'll recusively call the function again
if(allChildElements.item(j).className == "subform"){
LockAllFields(currentElement);
}
//If the objects are fields and they are set to mandatory (validate.nullTest) then we will set the border.fill.color - dependant on object type
else if(currentElement.className == "field"){
currentElement.access = "readOnly";
}
//Check for exclusion groups - Radio Buttons
else if(currentElement.className == "exclGroup"){
for(k=0; k< currentElement.nodes.length;k++){
if(currentElement.nodes.item(k).className == "field"){
//set the color for the radio buttons individually
currentElement.access = "readOnly";
}
}
}
}
}//end function
Thanks!
**Update: I have now worked this out. Thanks
ok Thanks for that info, i am on hold with Adobe Customer Care now, does anyone know how easy it is to switch my platform license to Windows? just did the upgrade to Pro 9 because i was told it would work on the mac, never was told about the feature differences between the two platforms.
Thanks,
Drew
Sorry, I would like to know how to go about controlling the state of the form once it's filled out, locked and saved, so when you open it again in Adobe it is not fillable.
On a previous thread Darrell asked:
Paul,
I am sorry, but I probably have completely misinterpreted what is going on here. I wish to have a fillable and savable form which I can fill out, but then save it as a static (nonfillable) PDF file. I know I can do this by printing the filled form to the Adobe PDF printer driver, but here is how I tried to use your example:
I used Acrobat Pro to activate the extended Reader features.
1. I filled out the form.
2. I locked the fields.
3. I saved the form.
When I reopened the form in Reader, the data entered above was there, but the form was still fillable. At this point, I would want the form to be unalterable. Where am I going wrong? Thanks, Darrell
Then your response was:
My script will simply lock all fields when it is executed. What target version are you setting this for. There is a parameter in the Form Properties that controls whether to save the state of the form when it is saved. Under File/Form Properties/Defaults make sure the "Preserve scripting changes to form when saved" is set to Automatic. That woudl only work in version 8 and better.
OR
You could control the state of the form yourself. You could have it set up to run my script when the form is opened. If there is data in a field then lock all fields on initialization otherwise leave it all open.
-
Original Message
OK Now I understand .....
When a form is designed if the field was unlocked and you programmatically changed the field to locked then when the form re-loads it will be unlocked because the form does not know what your code did to it. This is called changing the initial state of the form. So you can write code that will maintain that state or there is a parameter on the File/Form Properties/Deafaults menu that can do it for you. Make sure that you have the checkbox ticked that says "Preserve scripting changes to form when saved" set to Automatically.
Paul
Nope ...you have no choice but to code this into your form. So you will have to have some means of knowing that the form was previously locked. I suggest that you have a hidden field and use it as a flag. You can set a vvalue in that field before you lock all of the fields and check its status when you load the form again. If the flag is set then you will have to run the lock all fields code again. If it is not set then do nothing.
Does that make sense?
Paul
North America
Europe, Middle East and Africa
Asia Pacific