5 Replies Latest reply on Jul 23, 2010 11:08 AM by Ida Eve

    Creating an editable form that certain fields can be edited and locked.

    s437599 Level 1

      Hi, I'm trying to create a form in LiveCycle where I can do the following:

       

      1)  Create form in Live Cycle with pricing fields, and other editable fields

      2)  Allow our sales team to edit the pricing fields for their contracts in Adobe Professional.

      3)  Then allow the sales team to save this individual version (with their pricing) and send it to the prospective client.

      4)  The new client will be able to open the form in adobe reader/professional, enter data into the other fields, and not be able to change pricing information.

       

      What is the best way for me to go about this?

       

      Thanks in advance

        • 1. Re: Creating an editable form that certain fields can be edited and locked.
          Niall O'Donovan Level 7

          Hi,

           

          (in my opinion) The best way is to use digital signatures. You can assign the price fields to the signature, so that when the Sales person signs  the PDF, it locks the price fields.

           

          From a marketing perspective, it projects a good image to perspective clients, as the document is secure and the blue ribbon banner has your company name, etc.

           

          While you can create your own signatures, these will not be third party validated, and therefore will not have the same trust level (a "?" will appear in the signature panel when the potential client opens the form).

           

          If you don't want to deploy digital signature(s) to the Sales Team, there is a work around, BUT IT IS NOT COMPLETELY SECURE!!

           

          Create a button (and an optional image beneath it):

           

          13-05-2009 08-31-26.png

           

          In the click event have something like this:

           

          var nButton = app.alert({
              cMsg: "Warning after locking this alert, you will not be able to unlock it. \n\nDo you want to lock this alert?",
              cTitle: "Assure HSC",
              nIcon: 1, nType: 2
          });
          if ( nButton == 4 )
          {
               // 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"; // locks all fields
                         }
               }
             
               // save value of lock
               Lock.rawValue = "1"; // sets the value of a flag

           

               quantityfield1.access = "open"; // specify the fields you want available to the client
               quantityfield2.access = "open";
               quantityfield3.access = "open";

           

               padlockopen.presence = "invisible"; // this is the static image of a padlock

           

          }   

           

           

          In the Layout: Ready event of the button, you would have a check on the value of the flag (Lock.rawValue):

           

          if (Lock.rawValue == "0")
          {
              // 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 = "open"; // all fields open if Lock = 0
                    }
               }

               padlockopen.presence = "visible";
          }
          else
          {
              // 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"; // locks all fields
                          }
                }
              
               // save value of lock
               Lock.rawValue = "1"; // sets the value of a flag
              
               quantityfield1.access = "open"; // specify the fields you want available to the client
               quantityfield2.access = "open";
               quantityfield3.access = "open";

           

               padlockopen.presence = "invisible"; // this is the static image of a padlock

           

          }  

           

          The Lock object is a numeric field which does not have any script. Because we used a static image (which we hide when the form was locked), the button did not have a border or fill. The locking script also locked the button so that the user could not click it again.

           

          Once the form is "locked" users with Acrobat / Reader will not be able to change the protected fields.

           

          Please note that for this to be anyway effective you should password protect access to the form for LC Designer. Otherwise a client who has LC Designer could edit the form and change the Lock value back to 0, thus unlocking the form on reopening in Acrobat/Reader.

           

          A bit convoluted and as I say digital signatures may be easier; more professional looking.

           

          Good luck,

           

          Niall

          • 2. Re: Creating an editable form that certain fields can be edited and locked.
            s437599 Level 1

            Thanks for this.  I'm not sure if I want to be giving the sales team digital signatures so I am revisiting my options and if I need the document to be able to be edited twice (sales team and client).

            • 3. Re: Creating an editable form that certain fields can be edited and locked.
              Ida Eve Level 2

              I am also trying to create a form that is distributed to sponsers with text fields that are already filled out and protected.  I tried the code and I like how it works very much, but it isn't quite work for right for me.  It is locking up all fields and buttons, even after I have declared them "open" in the code.  Also, when I Save the form with an unique name, the fields are no longer locked when I open it.

               

              How can I tweak the code for text/button fields, and when it is Saved and distributed, how can I keep those fields locked?

               

              LiveCycle Designer ES 8.2

              • 4. Re: Creating an editable form that certain fields can be edited and locked.
                Niall O'Donovan Level 7

                Hi,

                 

                I think the issue where the locked fields become unlock when you reopen the form can be solved easily. I suspect that if you go to the File > Form Properties dialog you will see that 'Preserve script changes' in the Default tab is set to 'Manual'. I would recommend changing this to 'Automatic'.

                 

                Parallels Desktop1.png

                 

                When you say pre-populated, are you meaning from a database or manually typed in before the form is sent out?

                 

                If you want to lock certain fields you could use Paul's script (search forum for "LockAllFields"). In this example Paul has a script object (function) that is passed the name of the root node (form1). You could use this and instead pass the name of the subform that contains only the objects you want to lock, maybe a subform called "lockTheseObjects".

                 

                Another option is using a nice feature created by Kingphysh. It has a secret area that only becomes visible when set data is inoutted into three fields. In this secret subform there are three fields that are set to global in the Object > Binding. So when info is inputted into these, the values appear in fields on the main form (with the same names). Lastly these fields are set to read only.

                 

                Sample here: https://acrobat.com/#d=KfCS-2iLioZfmBfiSjzGNQ

                 

                Hope that helps,

                 

                Niall

                • 5. Re: Creating an editable form that certain fields can be edited and locked.
                  Ida Eve Level 2

                  Thank you for getting back with me. 

                   

                  Yeah!  Changing the Form Properties to Automatic made the form fields locked after it has been Saved.  But all fields are locked now, including buttons.

                   

                  Pre-populate: Staff will manually enter data into the text fields prior to distributing it out.  I am locking only certain fields and form users will be filling in the rest of the information.

                   

                  The fields I need to stay unlocked are dynamic table rows, I would lock them by subform, but there are 5 fields in the table (header row) that has to be locked. So the "LockAllFields" will not work for this situation.

                   

                  I will look into the Kingphysh feature to see if that will work for me.

                   

                  Can't understand why the fields I have defined "open" are not open for editing.

                   

                   

                   

                  Eve Tracy