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
Views
Replies
Total Likes
Please see the following sample which loops through all child elements in a subform.
I have it displaying the name of the objects.
Views
Replies
Total Likes
Francis play around with the above code, it's a simplified version of the script you are using.
I've used that node traversal script for a bunch of stuff myself but I'm trying to wrap my head more around Radzmar's simplified version as it looks like it would be a lot faster for larger forms. And it's getting into areas I don't know much about so I'm learning stuff too!
Views
Replies
Total Likes