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?
Solved! Go to Solution.
Views
Replies
Total Likes
No ....it must be there to be a valid schema....but it is not used by the product when offline.
Paul
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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
}
Views
Replies
Total Likes
Flattening makes a interactive form an image essentially. All dynamic and interactive behaviour is removed.
Steve
Views
Replies
Total Likes
So flattening is not the route I can take for this form, what other route would you suggest?
Eve Tracy
Views
Replies
Total Likes
You are changing the "state" of the form. There is a setting in the Form Properties that indicates whether you want to save thses changes automatically
or you (the Form Designer) will take care of it. Look under File/Form Properties/Defaults and make sure that the Save Scripting changes is set to Automatically.
Paul
Thank you everyone for the help. I ended up using the "secret space" method to make the text fields "Read Only" to users of the form and still giving staff the ablity to edit them. I found this fix on forum link
http://forums.adobe.com/message/2582721#2582721 using the
SecretSpaceExample.pdf as an example.
Changing the form properties to run script Automatically fixed many of my issues.
Next - Need to figure out how to manipulate XML export data. If anyone has a clue, I am listening.
Views
Replies
Total Likes
You will want this command:
xfa.host.exportData("", false)
This will bring up a dialog box to allow you to select a filename and it will give an XML extension (it woudl be xdp if you do not include the false at the end).
Paul
Views
Replies
Total Likes
So that will let me adjust how the form data is displayed in the xml export file? What event would that command be on?
Right now, the fields that are on top of the form, those values appear at the bottom of the document when exported in XML.. My Oracle guys want the exported values in XML a certain way so they can import it correctly.
Views
Replies
Total Likes
The XML data will follow the structure if the form in the hierarchy view unless you import a sample XML data file or you have a schema file (XSD). Then you can force the data to follow those structures by binding the field on th eform to the appropriate node in the data/XSD file.
paul
Views
Replies
Total Likes
Morning Paul!
I am going through the XML schema tutorial on w3Schools http://www.w3schools.com/Schema/default.asp. to create the xsd file, it isn't as difficult as I thought it would be. I have the fields set correctly in the hierarchy so I will have to use the schema method to get the desired layout.
I have some concerns on binding it to the fields. Some fields have the binding set as global to populate other "read only" fields, will changing the binding to an xml schema affect the global bindings of those fields? If so, can I change the binding on the form/subforms or does it have to be on the individual fields?
Eve Tracy
Views
Replies
Total Likes
Chnaging the binding to the schema will affect that ....but you can bind the same node in the schema to multiple fields
so simply bind the appropriate node to each individual field.
Ultimately you have to bind each individual field (unless the structure of the schema matches the form exactly).
Paul
Views
Replies
Total Likes
I will apologize in advance if this is a stupid question, but when you refer to node, what do you mean?
Eve Tracy
Views
Replies
Total Likes
A field in the schema......i.e.
<root>
<Field1>test</Field1>
</root>
root is a node and Field 1 is a child node of root. The value of the node Field1 is test
Paul
Views
Replies
Total Likes
Just to expand a little on what Paul said. A node can be in many places including but not restricted to the root:
<root>
<address>
<street>123</street>
<city>Chicago</city>
</address>
<bio>
<name>john doe</name>
<age>62</age>
</bio>
<jobs>
<job>123</job>
<salary>13.55</salary>
<job>456</job>
<salary>12.34</salary>
</jobs>
</root>
Root, address and bio are all nodes. Jobs is a node as well, but it is a repeating segment in that you can have many jobs. When you build the xsd you will have that in the file. AFA xsd is concerned, put in a couple of those jobs nodes so it will build it with the repeating option.
Okay, I think I understand the jest of it, when I bind the schema to the form, I need to define it to a subform or root to keep the global fields intact.
I think I have the schema coded properly, but I could use second set of eyes that understands it better than I do (1 day tutorial). I will add the form elements in () for those people out there like me that never had to do one of these before. Comments are commented out with //.
Still trying to figure out the right way to define the location w/out a url address for the schema file.
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com" elementFormDefault="qualified"> //Have to figure out how to define file location w/out URL
<xs:element name="form1"> (form1 - root)
<xs:complexType>
<xs:sequence>
<xs:element name="Wrapper"> (Wrapper - subform)
<xs:complexType>
<xs:sequence>
<xs:element name="Attendee"> (Attendee - subform)
<xs:complexType>
<xs:sequence>
<xs:elemnt name="FormID" type="xs:string"/> (FormId - text field)
<xs:element name="ProgramNumber" type="xs:integer"/>(ProgramNumber - number field)
<xs:element name="Sponser" type="xs:string"/> (Sponser - text field)
<xs:element name="TrainingLocation" type="xs:string"/>(TrainingLocation - text field)
<xs:element name="State"> (State - text field)
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:patten value="[A-Z][A-Z]"/> //Restrict to 2 capital letters
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ProgramDate" type="xs:date"/> (ProgramDate - date field)
<xs:element: name="EndDate" type="xs:date"/> (EndDate - date field)
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TrainingProgram"> (TrainingProgram - subform)
<xs:complexType>
<xs:sequence>
<xs:element name="body"> (body - subform)
<xs:complexType>
<xs:sequence>
<xs:element name="Table"> (Table - table element)
<xs:complexType>
<xs:sequence>
<xs:element name="HeaderRow" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup"/> (HeaderRow - 1st table row)
<xs:complexType>
<xs:sequence>
<xs:element: name="C1" type="xs:string"/> (C1 - text field)
<xs:element: name="C2" type="xs:string"/> (C2 - text field)
<xs:element: name="C3" type="xs:string"/> (C3 - text field)
<xs:element: name="C4" type="xs:string"/> (C4 - text field)
<xs:element: name="C5" type="xs:string"/> (C5 - text field)
</xs:squence>
</xs:complexType>
</xs:element>
<xs:group name="Item"> (Item - 2nd table row) //This is a group-will be duplicated - dynamic row
<xs:complexType>
<xs:sequence> //maxOccurs="unbounded" means unlimited
<xs:element name="ItemIndex" type="xs:integer"maxOccurs="unbounded"/> (# field)
<xs:element name="Cert" type="xs:integer"maxOccurs="unbounded"/> (# field)
<xs:element name="LastName" type="xs:string"maxOccurs="unbounded"/> (text field)
<xs:element name="FirstName" type="xs:string"maxOccurs="unbounded"/> (text field)
<xs:element name="C1_Hours" type="xs:integer"maxOccurs="unbounded"/> (# field)
<xs:element name="C2_Hours" type="xs:integer"maxOccurs="unbounded"/> (# field)
<xs:element name="C3_Hours" type="xs:integer"maxOccurs="unbounded"/> (# field)
<xs:element name="C4_Hours" type="xs:integer"maxOccurs="unbounded"/> (# field)
<xs:element name="C5_Hours" type="xs:integer"maxOccurs="unbounded"/> (# field)
<xs:element name="ConcatData" type="xs:string"maxOccurs="unbounded"/>(text field)
</xs:sequence>
</xs:complexType>
</xs:group>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Eve Tracy
Views
Replies
Total Likes
Is it possible to run an XML schema on a stand-a-lone form?
Eve Tracy
Views
Replies
Total Likes
Not sure I understand your question ......you can use a schema as a starting point for any form. The schema merely gives the
data that is being collected structure.
Paul
Views
Replies
Total Likes
My form is stand-a-lone, it will have no database nor is it placed on a website. Everything I have read about xml schema has some sort of http: data connection it seems like. I am confused about the this part.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com" elementFormDefault="qualified">
How would I reference a file location without using the a URL/URI/URN?
Eve
Views
Replies
Total Likes
Those links are neccessary when defining the schema but are only used to validate the data taht is generated against the schema. That is not part of what you are doing so it will not be a problem for you.
Paul
Views
Replies
Total Likes
So I can leave that out?
Eve
Views
Replies
Total Likes