Expand my Community achievements bar.

SOLVED

Enable/Disable subForm or row at once

Avatar

Level 2

Dear all,

I need to know if it possible to enable the whole subForm or even row at once?

I can see the access proterity for the rows but it doesn't work ..

Your help is much appreciated..

Best regards

1 Accepted Solution

Avatar

Correct answer by
Level 6

Hi Ryan,

I think we are using different versions of Adobe reader, or I miss something.

I made form with two buttons which set subform to readOnly and edit state. Also I put Target version of preview to Acrobat 9 (see attached screenshot).

In this case it works fine.

Example attached.

Best regards,

Paul Butenko

View solution in original post

11 Replies

Avatar

Level 6

Hello,

Try this exapmle.

Best regards,

Paul Butenko

Avatar

Level 2

Hello Paul,

Thanks for your reply, What I actually want is not to hide the row or the subform, but to keep it visible

and inaccessible to the end-user (disabled/grayed out) if possible.

Thanks and best regards

Avatar

Level 6

Hi,

I made new form for you.

Best regards

Avatar

Level 2

Hello Paul

I tried you example and it works perfect for tables not subform.

I tried this:

xfa.form.resolveNode(" form1.page1.Sub_a.lottary.Row1").access = "readOnly";

and even

form1.page1.Sub_a.lottary.Row1[0].access = "protected";

but in avail, any comment

Best regards

Avatar

Level 6

Hi,

Could you post your form, i will check it?

Best regards.

Avatar

Former Community Member

I don't think that by setting the access of a subform, its child elements will inherit that access.  I think you'll need to write a function to loop through each object of the subform and set it to the same access.  Try something like this...

function toggleContainer(container, accessVal){


     // Get the number of objects in the subform.

     var  nObjects = container.nodes.length;


     // Get the objects in the subform,

     var objects = container.nodes;


     // Loop through all the objects.

     for (var i=0; i<nObjects; i++){


          // Get the current object.

          var object = objects.item(i);


          // If the object is a field...

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


               // Set the access to the input.

               object.access = accessVal;

          }

     }

}

The function inputs are container (the subform to change the access of) and accessVal (open, readOnly, etc. to be set to).  I'm not sure if this is 100% correct...I just typed it out in the forum.  It should be close though.  You can call this function (as long as it works or gets fixed up) whenever you need to open or close a subform.  I recommend using a script object to house the function, but you can put it in an object's JavaScript (like a click event or something).  You also may want to be careful and use something other than the word "object".  I can't remember if it's a JavaScript reserved word, which may cause issues if it is.

Hope this helps!

Ryan D. Lunka

Cardinal Solutions Group

rlunka@cardinalsolutions.com

Avatar

Level 6

Hi,

Actually child elements inherits access setting of the parent subform. You can check it by sets access Read only to nain subform of your form.

Best regards.

Avatar

Former Community Member

I've never been able to establish the property inheriting functionality with subforms. In fact, I just set up a basic form to test it. I had a subform with a text field and button inside (to test if they inherited the access). I also added two more buttons outside of that subform. One pops up a message box displaying the access of the subform (to confirm it had been changed) and the other that toggles the access of the subform (if it's open, set it to readOnly and vice versa).

At first load, the access of the subform is actually "undefined", because in fact, you cannot set the access of a subform using the Designer object palette (like you can a field). I then click the button to toggle the access and it click the other to confirm that it is now set to "open". Both the text field and button inside the subform are functional. I click the toggle button again and confirm with the other button that the access is now set to "readOnly", BUT both the text field and button inside the subform are still functional. I can continue to toggle the access back and forth from open to readOnly, but the objects within the subform always remain accessible.

Is there some kind of special configuration you would use to allow access inheritance? I've continually used a function similar to the one I posted for this issue in the past. If there's an easier way, I'd be interested in hearing it.

Ryan D. Lunka

Cardinal Solutions Group

rlunka@cardinalsolutions.com

Avatar

Correct answer by
Level 6

Hi Ryan,

I think we are using different versions of Adobe reader, or I miss something.

I made form with two buttons which set subform to readOnly and edit state. Also I put Target version of preview to Acrobat 9 (see attached screenshot).

In this case it works fine.

Example attached.

Best regards,

Paul Butenko

Avatar

Level 2

Paul,

100% working ... I copy my subform to your and it is working perfect, although it is not working on my pdf.

Anyway, I will give it a try and if I didn't manage I will upload it so you can have a look at it (if you kindly agreed).

Thanks and best regards.

Your help is much appreciated.

Avatar

Former Community Member

Aha!  It was the target version.  I played around with your form and when I set the target version to Acrobat 8.1, the functionality no longer worked.  It's nice to know Adobe added that inheritance starting with Acrobat 9.  If you have control over a user's Acrobat level, that's definitely a WAY better option than the loop.  Thanks for the information!

Ryan D. Lunka

Cardinal Solutions Group

rlunka@cardinalsolutions.com