Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

How to make the fields dynamic read only in live cycle designer

Avatar

Former Community Member

hi folks

I have created a form in Adove livecycle es. Some fields should be read only from the start. So i have set the property .access 'open'. In versions of Adobe 8 this works, but in the latest version  it won't so i think it should be done via another solution. Does anybody know how?

kind regards,

Anton Pierhagen

1 Accepted Solution

Avatar

Correct answer by
Level 10

May be the below code may help.. It loops thru all the pages in the PDF form and make them protected. So the user can not change any value in the form.

for (var i = 0; i < xfa.host.numPages; i++)
{
var oFields = xfa.layout.pageContent(i, "field");
var nodesLength = oFields.length;

//set the access type to be protected for all fields
for (var j = 0; j < nodesLength; j++)
{
var oItem = oFields.item(j);
oItem.access = "protected";
}
}

Thanks

Srini

View solution in original post

6 Replies

Avatar

Level 10

If you want to make the fields readonly you can use one of the below..

this.access = "readOnly";

this.access = "protected";

Thanks

Srini

Avatar

Former Community Member

Hi

Thanks for your answer. But that's not what i am looking for. If you have a structure like:

subform

               subform

                         field A

                         field B

subform

subform

               field A

               field B

And in your initialisation event of the data object you want to dynamicaly make sure everything is set on access 'read only'

What is a proper solution for that?

Avatar

Level 10

subform1
               subform2
                         field A
                         field B
subform3
subform4
               field A
               field B

If your structure looks like above then you can write code in any initialize event that subform1.access = "readOnly"; So it will make all the fields under subform1.

Or if you want make all the fields in subform1, subform2, subform3, subform4, then you need to set the presence property of the root subform, i.e. parent of the subform1.

Will this help..

Thanks

Srini

Avatar

Former Community Member

I am looking for some code where you don't hard coded the name of the fields

like an for loop or something like that:

for example:

for(var count; count< object.nodes; count++)

{

      if ( object.type == textfield)

       object.access = "readOnly"

}

something like that. So that you set everything dynamically

Avatar

Correct answer by
Level 10

May be the below code may help.. It loops thru all the pages in the PDF form and make them protected. So the user can not change any value in the form.

for (var i = 0; i < xfa.host.numPages; i++)
{
var oFields = xfa.layout.pageContent(i, "field");
var nodesLength = oFields.length;

//set the access type to be protected for all fields
for (var j = 0; j < nodesLength; j++)
{
var oItem = oFields.item(j);
oItem.access = "protected";
}
}

Thanks

Srini