Expand my Community achievements bar.

access = protected dosen't work on my existing form.

Avatar

Former Community Member

Hi All,

I am trying to make a subform of my exisitng form as "protected". The following is the line of code used on the docReady event of the form":

form.access = "protected";

When i created a new form and added the above piece of code, things are working fine.

I'm not sure what is wrong with my exiting form.

Could someone please help me identify the bug?

Please Note: I'm not sure how to attach my files here. I can mail them upon request.

Thanks,

Vijay Kumar.

2 Replies

Avatar

Level 10

Hi,

did you name your subform "form"?

That's not a good idea, as this is a reserved word in the XFA grammar.

Also, the access property has to be set for each field individually, its setting will not be inherited to the child objects in a subform.

For this purpose you can use a loop funktion.

Example: This function will lock all fields in a form.

function lockFields(vNode) {

if (vNode.className === "field") {

vNode.access = "readOnly";

}

for (var i = 0; i < vNode.nodes.length; i += 1) {

lockFields(vNode.nodes.item(i));

}

}

lockFields(xfa.form);

Avatar

Former Community Member

Hi,

Thanks for your prompt reply.

I'm afraid that I should say I'm not satisfied with the reply.

1) The root of my form is named as 'form' and not the sub form .

2) If settings can't be inherited to the children of a subform, how things are working on a new form (as mentioned earlier)

3) when I copy my all the existing subforms into a new subform , things have starting working fine.

It would be great if you could explain the behavior.

Thanks,

VJ