I have a check box that is positioned above many other boxes on a sheet. I want that check box to serve as a "check all" by checking all the boxes beneath it when it is selected. I am sure there is a script for this but I am not familiar.
Thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
Try this:
var suffix=/(\w+_)D$/.exec(this.name)[1];
var i=1;
while (xfa.resolveNode(suffix+i)!=null){
xfa.resolveNode(suffix+i).rawValue=this.rawValue;
i++;
}
Kyle
Views
Replies
Total Likes
Try this:
for (var a=0;a<YourSubform.nodes.length;a++){
vNode=YourSubform.nodes.item(a);
if (vNode.className=="field" &&
vNode.ui.oneOfChild.className=="checkButton" &&
vNode.parent.className!="exclGroup"){
vNode.rawValue=this.rawValue;
}
}
Where 'YourSubform' is the name of the subform with the checkboxes. Also, all On/Off values under the Binding tab must be the same.
Kyle
Views
Replies
Total Likes
Can you include an image of the form that this was being used in? Not sure what is part of the script and what is unique to the form it was used in
This is how I want it to work where if any of the top boxes are checked, then the boxes directly beneath them will be checked as well. My binding names are ASSAY_D for the top "assay box" and ASSAY_1 beneath it and ASSAY_2 beneath that, etc.
Views
Replies
Total Likes
Are all the checkboxes under the same subform?
Kyle
Views
Replies
Total Likes
Yep
Views
Replies
Total Likes
Put this in the change event (JavaScript) of all your 'Check All' boxes:
var suffix=/[^_]+/.exec(this.name);
var i=1;
while (xfa.resolveNode(suffix+"_"+i)!=null){
xfa.resolveNode(suffix+"_"+i).rawValue=this.rawValue;
i++;
}
Kyle
Views
Replies
Total Likes
Cool that worked, kinda. I got the following result
So, as you can see, it worked for two full comlumns and almost a full column for the third. However, 3 of them did not work at all. the binding names for the ones that did not work are THN_SEC_1, THN_SEC_2, etc. I have a feeling that the underscore in the binding name messed it up. I can remove the underscores but I would prefer not to. Any other way?
Views
Replies
Total Likes
Do all the top checkboxes end with _D ?
Kyle
Views
Replies
Total Likes
Yep
Views
Replies
Total Likes
Try this:
var suffix=/(\w+_)D$/.exec(this.name)[1];
var i=1;
while (xfa.resolveNode(suffix+i)!=null){
xfa.resolveNode(suffix+i).rawValue=this.rawValue;
i++;
}
Kyle
Views
Replies
Total Likes
It worked. Wow how can I thank you enough!? I am very thankful for your help, Kyle.
Cheers,
WES
Views
Replies
Total Likes
What if I want to continue onto the next page with this script. As in...
Can I remove the "Check All"s from the second page and have the script from the first continue to these check boxes somehow? This is asking alot but you have been so helpful so far. They have continued suffix (as in page 1 ends with ASSAY_13 and page 2 starts with ASSAY_14)
Views
Replies
Total Likes
Try this on for size:
var vNodes=this.parent.parent.resolveNodes('#subform[*].#field.(this.name.substr(0,this.name.length-1)=="'+this.name.substr(0,this.name.length-1)+'")');
for (var a=0;a<vNodes.length;a++)
vNodes.item(a).rawValue=this.rawValue;
Kyle
Views
Replies
Total Likes
That one only filled down 9 boxes
Views
Replies
Total Likes
Say Yes to the JavaScript
var vNodes=this.parent.parent.resolveNodes('#subform[*].#field.(this.name.indexOf("'+this.name.substr(0,this.name.length-1)+'")!=-1)');
for (var a=0;a<vNodes.length;a++)
vNodes.item(a).rawValue=this.rawValue;
Kyle
Views
Replies
Total Likes
You are a wizard. Thanks so much
Views
Replies
Total Likes
I would also like to have one box that adds up the values of multiple boxes on multiple pages. The boxes to be added have the binding name INTVL_1, INTVL_2, INTVL_3, etc.
On a side note, where do you learn scripting like this?
Views
Replies
Total Likes
Sorry, you've reached your daily limit ; )
In all seriousness though, start a new thread for the addition question.
You can learn about SOM predicates in the XFA Specification or
http://blogs.adobe.com/formfeed/2008/10/data_binding_with_predicates.html
Bruce BR001 really opened my eyes to the power of predicates with his search function http://forums.adobe.com/thread/518910
Kyle
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies