Targeting all objects in multiple subforms with a shared name throughout a form

Avatar

Avatar

JdL

Avatar

JdL

JdL

20-12-2012

Hi

Jono Moore was able to find an excellent solution from an original by Radzmar for targeting subforms throughout a form that share a name:

function hideSubs(vNode) {
     if (vNode.className === "subform") {
          //name of subform you're targeting
          if (vNode.name === "targetSub") {
               vNode.presence = "hidden";
          }
     }
     for (var i = 0; i < vNode.nodes.length; i += 1) {
          hideSubs(vNode.nodes.item(i));
     }
}
hideSubs(xfa.form);

Has anyone any thoughts on how to extend this functionality to select the object within those subforms?

So:     (1) find all subforms with the shared name (a solution above), then

          (2) select all objects inside those subforms only (all types: text fields, radio buttons, check boxes, etc.).

The intention is to lock these down and to apply a colour change (from white to grey) as a visual cue. The solution above allows the background colour of the subforms to be changed, but what is required in this case is a colour change to the value backgrounds of the objects within those subforms only.

Any thoughts grately appreciated.

Thanks

View Entire Topic

Avatar

Avatar

Francis_Manly-E

Avatar

Francis_Manly-E

Francis_Manly-E

20-12-2012

Please see the following sample which loops through all child elements in a subform.

I have it displaying the name of the objects.

https://workspaces.acrobat.com/?d=xuXORnYLNfXTNxUHukLJMw