How do you make a text field Read Only after it is saved and distibuted? | Community
Skip to main content
July 21, 2010
Solved

How do you make a text field Read Only after it is saved and distibuted?

  • July 21, 2010
  • 23 replies
  • 16522 views

How do you make a text field read only after it is saved and distibuted?

LiveCycle Designer ES 8.2

This JavaScript code on the exit event:

textField1.access = "readOnly";

This works after the user loses focus on the field, however after it is saved and distributed, that field is no longer "read-only".

I need to have staff insert information into a text field and then distribute it out to customers, and those fields have to be protected.

How do you do this?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by

No ....it must be there to be a valid schema....but it is not used by the product when offline.

Paul

23 replies

July 22, 2010

Flattening makes a interactive form an image essentially. All dynamic and interactive behaviour is removed.

Steve

July 22, 2010

Steve,

Thank you so much for getting back to me, I really appriecate it.

I found a post (http://forums.adobe.com/message/1958770#1958770) that had the following code, which works great for what I am needeing!

But, after I save the form as another name and reopen it, the fields are no longer protected.  Would "flattening" make it so.  And if I "flattened" my form will the dynamic table rows continue to work?  I don't know much about this Flattening process and this is the first I have heard about it, so I am a bit unsure if that is the route I need to take.

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

}

July 22, 2010

A common approach is to make the form non-interactive through a process often referred to as 'flattening'. There are a number of services available in the LiveCycle ES server suite to accomplish flattening.

In the absence of the LiveCycle ES server suite, flattening can be accomplished by printing the interactive form to PDF. The only requirement is that Acrobat would have had to have been installed on your desktop to enable printing to PDF.

Steve