I am trying to hide only the repeating table sections ("ActionItemsGrp") that have a date entered in the "ClosedDate" date field when a button is clicked. This is the code I have been trying to get to work:
This is my form hierarchy:
Can't figure out what is wrong with the script.
Solved! Go to Solution.
Views
Replies
Total Likes
Oh ya no, subformSet's can't be hidden. Didn't see that.
Just take your existing code and add Row3 4 and 6 to hide...Also you don't need the third 'for' loop because your Row5 doesn't repeat.
Should look like this:
for (var a=0;a<Form1._Table1.count;a++){
for (var b=0;b<Form1.Table1.all.item(a)._ActionItemGrp.count;b++){
if (Form1.Table1.all.item(a).ActionItemGrp.all.item(b).Row5.ClosedDate.rawValue!==null){
Table1.all.item(a).ActionItemGrp.all.item(b).Row3.presence="hidden";
Table1.all.item(a).ActionItemGrp.all.item(b).Row4.presence="hidden";
Table1.all.item(a).ActionItemGrp.all.item(b).Row5.presence="hidden";
Table1.all.item(a).ActionItemGrp.all.item(b).Row6.presence="hidden";
}
}
}
Also it might be easier at this point to use plain subforms instead of tables. That way you could just wrap all those 'Rows' in a subform and hide that subform. The only time I use tables is when I want the cells in a row to expand equally during run-time.
Kyle
Views
Replies
Total Likes
What does it say in your JavaScript console (Ctrl-J)?
Kyle
Views
Replies
Total Likes
When I click the button nothing happens.
Here's my console...
Views
Replies
Total Likes
Looks like the condition in your second 'for' loop doesn't include the instance index for your Table1: b<Form1.Table1.all.item(a)._ActionItemGrp.count
Kyle
Views
Replies
Total Likes
This is what I have now but the button still does not work. Do you see anything else wrong? I only want to hide the entire "ActionItemGrp" when row 5 has a date in "ClosedDate" field.
Views
Replies
Total Likes
I see all.items when it should be all.item. That should definitely come up as an exception in your console.
Kyle
Views
Replies
Total Likes
My console used to pop-up during errors but doesn't anymore. What settings are correct for Acrobat X under the javaScript settings window?
Views
Replies
Total Likes
Here's my form... can you take a look at it for me?
Views
Replies
Total Likes
Can't always get Workspaces. Try this.
Kyle
Views
Replies
Total Likes
Okay - I uploaded the file.
Thanks
Views
Replies
Total Likes
This is what I see in the console:
Form1 is not defined
1:Console:Exec
ReferenceError: Form1 is not defined
1:Console:Exec
undefined
Views
Replies
Total Likes
Opened your form, tried it out and the button works. Hides all the Row5's that have a Closed Date.
Kyle
Views
Replies
Total Likes
Yes - but I am trying to get the button to hide the entire "ActionItemGrp" table sections - only those that have a ClosedDate in Row5. Those without a date remain open.
Views
Replies
Total Likes
It appears table sections cannot be hidden. I need to find a script that will hide rows 3, 4, 5 and 6 (which make up the table section) only when row 5 has a closed date in the ClosedDate object.. The other sections/rows stay open.
Views
Replies
Total Likes
Oh ya no, subformSet's can't be hidden. Didn't see that.
Just take your existing code and add Row3 4 and 6 to hide...Also you don't need the third 'for' loop because your Row5 doesn't repeat.
Should look like this:
for (var a=0;a<Form1._Table1.count;a++){
for (var b=0;b<Form1.Table1.all.item(a)._ActionItemGrp.count;b++){
if (Form1.Table1.all.item(a).ActionItemGrp.all.item(b).Row5.ClosedDate.rawValue!==null){
Table1.all.item(a).ActionItemGrp.all.item(b).Row3.presence="hidden";
Table1.all.item(a).ActionItemGrp.all.item(b).Row4.presence="hidden";
Table1.all.item(a).ActionItemGrp.all.item(b).Row5.presence="hidden";
Table1.all.item(a).ActionItemGrp.all.item(b).Row6.presence="hidden";
}
}
}
Also it might be easier at this point to use plain subforms instead of tables. That way you could just wrap all those 'Rows' in a subform and hide that subform. The only time I use tables is when I want the cells in a row to expand equally during run-time.
Kyle
Views
Replies
Total Likes
Thanks Kyle - works great!
Views
Replies
Total Likes
Views
Likes
Replies