Skip navigation

Saving Fillable Form as non-fillable PDF

Apr 8, 2008 10:41 AM

  Latest reply: bijoy, Mar 23, 2014 10:20 AM
Replies 1 ... 4 5 6 7 8 ... 10 Previous Next
  • Currently Being Moderated
    Sep 27, 2010 8:35 PM   in reply to pguerett

    paul, i did test the PO form you created but it seems when locked the email button was locked as well...thus preventing the user to email the form. any solution for this?

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 28, 2010 4:58 AM   in reply to ahmadmoonsyi

    Sure ....with a slight adjustment to the scripting object you can eliminate all of the locking of the buttons. I am using the naming convention of the buttons to know that I am dealing with a button. Here is a modified sample.

     

    Paul

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 28, 2010 6:11 PM   in reply to pguerett

    thank you so much! there's some bugs though but i could get the picture.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 29, 2010 4:17 AM   in reply to pguerett

    Hi Paul,

     

    I'm reading your post and your answers, but somehow i cant do it. I've downloaded Lock All Fields - not buttons_Purchase Order.pdf and copied your script (myScriptObject.LockAllFields(form1);) to my regular button. It doesn't work....What im doing wrong?..missing something?..I have to say that im lowler then novice....

     

    Can you help me plese?

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 29, 2010 5:42 AM   in reply to Mar.ko

    Can you send the form and a description of th eissue to LiveCycle8@gmail.com and I will have a look when i get a chance.

     

    paul

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 29, 2010 11:30 PM   in reply to Mar.ko

    Hi,

     

    One thing that may have happened is that you only copied the button into your form.

     

    The button has the following script:

     

     

    myScriptObject.LockAllFields(form1);

     

     

    This line calls a function named 'LockAllFields'. This is not a built-in function, it is a custom script written by Paul and it is stored in a script object, called 'myScriptObject'.

     

    The syntax in the click event of the button is the full reference to the function: [name of script object].[name of function](parameter);

     

    If you look at the hierarchy, you can see the 'myScriptObject' in the Variables, under the purchaseOrder page.

     

    Calling function in script object.png

     

    If you select the script object you can look at the function in the script editor.

     

    The sequence is:

    • User clicks button;
    • Click event calls 'LockAllFields' function and passes 'form1' (which is the root node) into the function;
    • Function in the script object runs through and locks all fields.

     

    So all the action is happening in the script object and not really in the button at all.

     

    So for your form you will need to copy 'myScriptObject' as well as the button.

     

    Hope that helps,

     

    Niall

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 29, 2010 9:48 PM   in reply to pguerett

    paul,

     

    how to create the fComment variable in that form? seems that i couldn't find how nor copy it to my form. is it some kind of object or a class something?

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 30, 2010 2:12 AM   in reply to Niall O\'Donovan

    Hi Niall,

     

    Thank you for your answer. Now I understand what I'm missing, but still dont know how to add "myScriptObject" in the Hierarchy palette on the left. I'm sorry but i dont have any experiance in scripting.

     

    I created a form with couple of text fields and drop down lists. Also, i have 4 buttons included (Lock_button, SaveAs_button, Reset_Button and Submit_button with costum script you wrote for me) .

     

    Here is my scenario:

     

    When user open the form he/she sees only Lock_button and Reset_button. When they fill the form and hit lock button the form fields are locked and the Lock_button desappears. Desappering of the Lock_button triggers SaveAs_button to become visible. When they finish saving non fillable pdf the SaveAs_button desappears and that triggers Submit_button to become visible. Now they hit submit button which opens outlook with costum script. Reset Button is visible all the time.

     

    I'm stacked with Lock_button and with setting visability of the buttons. Feal like Grimsby playing in premier league.......

     

    https://acrobat.com/#d=uLq7FOEliO*MHLOWFrvDZg

     

    Help please

     

    It works now. I figured out where i had to place the function script.

     

    Can you help me with visability?

     

    thanks 

     

    Message was edited by: Mar.ko

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 30, 2010 2:19 AM   in reply to Mar.ko

    By heck,

     

    Here is the form back to you: https://acrobat.com/#d=*jSHIzy-zFVL-QNo6KCQ1Q

     

    There are a couple of ways you can do this.

     

    This is probably the easiest:

     

    Step 1: Right-click on 'page1' and click 'Insert Script Object'. This will insert a blank script object, which is unnamed.

    Step 2: Name the script object. In this case you want to match Paul's script object name: 'myScriptObject'.

    Step 3: Open Paul's form and copy ALL of the script from his script object.

    Step 4: Go back to your form and paste the script into your script object.

    Step 5: Test - any problems open the Javascript Console (Control+J) and see if there are any errors showing up.

     

    The other option is to open Paul's form and drag the script object into the Fragment library (next to the Object Library). Then open your form and drag the fragment onto 'page1'. This will insert the script object as a fragment. Right-click on it and from the fragment menu convert the fragment to an object. Test, test, test...

     

    In relation to the buttons, I have script in the lock all fields button AFTER the function is called to hide the lock button and the reset button. The save as button is then made visible. This is possible by accessing the .presence property.

     

    A similar approach is used on the saveAs button, however this is tricker. At the moment I have the script in the click event of the saveAs button, however if the user cancels the save action, the buttons presences still change. So I have used Radzmar's solution to check if the form is dirty.

     

    A couple of things:

    1. I named the page, 'page1'. I would recommend that you name all objects, including pages and subforms as you go. You may want to check your scripts to make sure they still work.
    2. Paul has added in a test for buttons in his function, so that they would not be locked. This does not appear to work for the reset button, so I have changed its type to regular button. The reset script still works, but now the button does not get locked.

     

    I hope this helps,

     

    Niall

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 30, 2010 2:35 AM   in reply to Niall O\'Donovan

    Amazing!!!!

     

    That's excely what i want...

     

    Thank you so much Niall !!!!

     

    Thank you Paul for the script

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 30, 2010 5:21 AM   in reply to Niall O\'Donovan

    Hi Niall,

     

    Me again....

     

    I've tested the form and noticed that I need to have reset button after my users send me the file. So they should be able to start filling the form again immediatly after they finished with previous one.

     

    I added this line of code( Button5.presence = "visible") in click event of the submit button. It works, but it should unlock the form so they can start using the form again!  How can I achive that?

     

    Thank you for helping me

     

    Marko

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 30, 2010 5:45 AM   in reply to Mar.ko

    Hi,

     

    This is an excellent opportunity to look at the function in detail.

     

    Basically you need to create a similar function to unlock all the fields. This is very straightforward.

     

    First go into the 'myScriptObject' and copy all of Paul's function. Then go below his function and paste. You now have two separate functions in the one script object, this is perfectly normal - you just need to rename the new one:

     

    /*************************************************************************************
    Function: UnLockAllFields
    Description: This function will unlock all fields.
    IN: The parent subform. It could also be an element that contains subform like form1
    OUT : nothing
    
    **************************************************************************************/
    
    function UnLockAllFields(myParentObject){
    
              var allChildElements;
              ...
    

     

     

    See how I have called it 'UnLockAllFields'.

     

    Now you need to edit this new function. Paul has two lines that set the access of the currentElement to 'readOnly'. You need to change this in your new function to 'open' (in just two locations):

     

    currentElement.access = "open";

     

    The last step is to call the function in your 'reset' button. I would put this line at the start of the script:

     

    myScriptObject.UnLockAllFields(form1);

     

    Should work - good luck,

     

    Niall

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 30, 2010 6:58 AM   in reply to Niall O\'Donovan

    Hi Niall,

     

    I've copied/pasted/renamed Paul's function just like you said, but it doesnt work. In the reset button i already have script (again written by you of course ) and that works but the form stays unfillable. I also tried to place "myScriptObject.UnLockAllFields(form1);" before it and after it as well. When i tested, it doesn't work.

     

    here is the file with last modications:

     

    https://acrobat.com/#d=tp-spETA1mR9w*VzMpJXig

     

    Marko

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 30, 2010 7:59 AM   in reply to Mar.ko

    Hi Marko,

     

    Here is the form back: https://acrobat.com/#d=garF1g40Y2T-s294LxnVOg

     

    There was a line that I neglected to highlight to you.

     

     

    if(allChildElements.item(j).className == "subform"){
         UnLockAllFields(currentElement);
    }
    

     

    Basically this is testing if the currentElement is a subform AND if it is, the script reruns the function, this time passing the subform in as the parameter. This basically ensures that all objects are locked, no matter how deep they are buried in nested subforms.

     

    That should get you out of the blocks,

     

    Niall

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 30, 2010 8:42 AM   in reply to Niall O\'Donovan

    Hi Niall,

     

    everything works now...

     

    I really don't know how to thank you for all your patience...

     

    Stay beautiful

     

    Marko

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 3, 2010 10:05 PM   in reply to (Tricia_B)

    Hi Paul,

     

    Could you send me a copy of the script as well. Thanks!

     

    jeelee[AT]gmail.com

     

    thanks

    simjl

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 4, 2010 5:06 AM   in reply to simjl

    Its already posted as an attachment on my Feb 11 post in this discussion thread.

     

    Paul

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2010 8:26 PM   in reply to pguerett

    hi paul,

     

    can you enlighten me the fcomment object you created in the form? how to create one as well, since i couldn't copy the thing to my form.

     

    fcomments.PNG

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 7, 2010 5:16 AM   in reply to ahmadmoonsyi

    That is a global variable that is defined in the File/Form Properties/Variables tab .....see the screen shot below:

     

    screen1.png

     

    Paul

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 18, 2010 4:27 AM   in reply to sydewinder

    Hello Paul,

     

    I used your script. But my need is if the user submits the form by clicking the button (which submits the pdf in an email) then : The email receiver when opens the form it should be readonly. But in my case it's editable. I am using LiveCycle Designer 8.2 and Acrobat 9 pro. The target version is : Acrobat or Adobe reader 8.1 or later.How to get it over with ?

     

    Thanks.

     

    Bibhu.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 18, 2010 6:31 AM   in reply to Bibhu Bikash Nayak

    Is the script being run before you email it? If so then you are not saving teh state of the form. In the File/Form Properties/Defaults tab make sure that the Radio button that controls the "Preserve Scripting Changes...." is set to Automatically. If you are asking where the script should be executed ...you can add teh call to to the preSubmit event of the button.

     

    Paul

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 18, 2010 6:42 AM   in reply to pguerett

    Hello Paul,

     

    Thanks. It worked. But to my surprise few fields in the form are still editable. But not those where I have entered the data. How this can be possible ?

     

    Thanks.

     

    Bibhu.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 18, 2010 7:20 AM   in reply to Bibhu Bikash Nayak

    Well then those are not getting locked by the script ......are they included in your calls to lock the form? Are they being changed by script after the fact?

    Paul

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 18, 2010 7:25 AM   in reply to pguerett

    Hello paul,

     

    As I am locking the entire form , so those fields are definitely included.No , they are not being cganged after the script. What can be the problem ?

     

    Thanks,

     

    Bibhu.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 18, 2010 7:28 AM   in reply to Bibhu Bikash Nayak

    Can you put a button on the form and call the lock script through that ...see if they are locked right after making the call.

     

    This is just a test ...i do not expect that the button will remain on the form when we have figured this out.

     

    Paul

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 18, 2010 10:30 PM   in reply to pguerett

    Hello Paul,

     

    I did the same as you have said. I used a simple button to lock all the fields present across several pages in that form . But those few fields are still not getting locked. What can be the problem with those fields ?

     

    Thanks.

     

    Bibhu.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 19, 2010 6:21 AM   in reply to Bibhu Bikash Nayak

    Then that prooves that either they are not included in the subform that is being passed to the Locking code .....or the code has been modified to ignore those fields. I cannot tell specifically without seeing your form. Can you share it with me? If so send it to LiveCycle8@gmail.com and include a description of the issue.

     

    Paul

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 19, 2010 7:01 AM   in reply to pguerett

    Hello Paul,

     

    There was some grouping in the form. I mean there are several check boxes and text fields which are grouped separately in different groups. I removed the grouping and it worked. I just confused, is it really the grouping issue or something else ?

     

    Thanks.

     

    Bibhu.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 19, 2010 7:25 AM   in reply to Bibhu Bikash Nayak

    Yes the scripting object does not deal with groups. You could change the groups to a subform and that will work ....or you could modify the script object to deal with groups.

     

    paul

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 10, 2010 10:22 AM   in reply to pguerett

    Hi

    Could I please get a copy of that script too?

    Thanks!

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 16, 2010 3:33 PM   in reply to pguerett

    Hi there:

    Could you email a copy of that script as well?  Thx!

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 17, 2010 7:37 AM   in reply to kbourg26

    The 2nd entry in this thread has the form attached.

     

    Paul

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 29, 2010 7:26 AM   in reply to pguerett

    Hey Paul,

     

    First off thanks for providing this script for everybody!  You truly are a life saver!!!

     

    Second, okay i got your script to work as a button, but what I would like is a tad different.

     

    Would it be possible for me to have the script run once I click "file">"save as" and then the person who typed the quote in this case would name the file what they want, save it and then the original file would become unlocked while the newly saved file will be locked?

    EDIT: ^^^^^^Scratch that part of my message, it was easy enough to set the code to lock it once i save it from clicking "file">"save as"....and obviously the original file is not locked.

     

    The problem im having is there are times where we will send out a quote to a customer, and then we will need to make a provision to the quote upon the customers request.  So is it possible to unlock the PDF after it is locked so that we can make adjustments and not have to re-type everything?

     

    What would be perfect is if i could have two buttons at the end of my PDF file.  One would be to save for our copy that can be edited later on, and the Second would be to save the file with all fields locked.

     

    Please enlighten me if this is even possible.

     

    Thanks for any help!

     

    Message was edited by: HKSevo8 Part of message was unnecessary, which is the quoted part :)  Note: Refer to txt below commented part of post.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 29, 2010 1:43 PM   in reply to HKSevo8

    Okay i think that i solved my problem, but i came up with yet another issue  "/

     

    Okay i made one button as a test that says "Save Un-Locked" that I have the javascript under click to be

     

    app.execMenuItem("SaveAs");

     

    And then i made a second button that says "Save Locked" that I have the javascript under click to be:

     

    app.execMenuItem("SaveAs");

     

    myScriptObject.LockAllFields(form1);

     

     

    The issue that I am coming up with is once i click the first "Save Un-Locked" button, the "save as" dialog pops up, i save the file, and then the same dialog pops up again so i click either save once again or cancel....then the following error pops up:

     

    save as error message.png

    Even though i get that error message, the buttons seem to be working.  When I click Save unlocked, a copy is saved that can be editied later.  When I click save locked, all fields become locked for the newly saved PDF.

     

    Any ideas?  It is possible to have two save as buttons correct?

     

    Thanks

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 29, 2010 3:56 PM   in reply to HKSevo8

    The issue is that th elanguag you have set for the command app.execMenuItem is FormCalc but that is a javascrip command ....change the language to Javascript and you shodul be OK.

     

    paul

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 30, 2010 6:19 AM   in reply to pguerett

    Thanks for the reply Paul,

     

    Yea I thought the same after reading that error, but thats not the case.  I triple checked to make sure the language for both buttons under "click" was set to javascript.  I even set the "All Events" section to javascript.

     

    Any other ideas?

     

    Thank again for the help!

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 30, 2010 6:37 AM   in reply to HKSevo8

    Solved my own problem again lol,

     

    IDK why I was getting the errors, but i decided to just delete the damn things and start over.  After re-making the two buttons, they both work like a charm!!

    Did nothing different from the first two buttons.  Weried hahaha

    As long as they work, thats all I care about haahaha

     

     

     

    I think I have one last quesiton though.

     

    Is there a way to save the PDF that will have all locked fields, without those two buttons showing up?  I would perfer that our customers not see the save as buttons ya know?

     

    Thanks

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 31, 2010 7:01 AM   in reply to (Tricia_B)

    Please can you send me th script, I have also similar issue.

     

    bala_21_us@yahoo.com

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 2, 2011 3:41 PM   in reply to (Tricia_B)

    Can you please send me the script also.

     

     

    bkoenig@carolinemd.org

     

     

    THANKS

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 2, 2011 8:35 PM   in reply to pguerett

    Respected Sir,

     

    I have create form using Adobe ES . But user can not save it , as they don't have reader extension on there destop m/c.

    Is there any other way or script to save a pdf form as non-fillable pdf with only adobe reader only.

     

    Please reply

     

    Thanks

     
    |
    Mark as:
1 ... 4 5 6 7 8 ... 10 Previous Next
Actions

More Like This

  • Retrieving data ...

Bookmarked By (2)