I have linked my form below. I am trying to script the "Hide Closed" button. I want to hide all of the instances of the "ActionItemGrp" table sections when the user has entered a date in the "ClosedDate" field. I tried the following script but can not get it to work.
Form1.ButtonsPage.HideClosed::click - (JavaScript, client)
for (var a=0;a<Table1.ActionItemGrp.instanceManager.count;a++){
for (var b=0;b<Table1.ActionItemGrp.all.item(a).Table1.ActionItemGrp.Row5.instanceManager.count;b++) {
if (Table1.ActionItemGrp.all.item(a).Table1.ActionItemGrp.Row5.all.item(b).ClosedDate.rawValue!==null)
Table1.ActionItemGrp.all.item(a).presence = "hidden";
}
Link to my file on WeTransfer: http://we.tl/bmZjwdb52u
Help is apprecaited...
Solved! Go to Solution.
Views
Replies
Total Likes
Ah ok.
That's tricky but this script should do it.
for (var t = 0; t < _Table1.count; t += 1) {
for (var a = 0; a < xfa.resolveNode("Table1[" + t + "]")._ActionItemGrp.count; a += 1) {
var aTarget = xfa.resolveNode("Table1[" + t + "].ActionItemGrp[" + a + "]");
if (!aTarget.Row5.ClosedDate.isNull) {
aTarget.Row3.presence = "hidden";
aTarget.Row4.presence = "hidden";
aTarget.Row5.presence = "hidden";
aTarget.Row6.presence = "hidden";
}
}
}
Views
Replies
Total Likes
I don't see how this object reference would work:
Table1.ActionItemGrp.all.item(a).Table1.ActionItemGrp.Row5.all.item(b).ClosedDate.rawValue
It appears that you've restarted the hierarchy (Table1) in the middle of an object reference.
Views
Replies
Total Likes
Scott-Mc,
Thanks for your reply. The script example i gave does not work. Can you help me figure it out?
Views
Replies
Total Likes
This does not work either...
Form1.ButtonsPage.HideClosed::click - (JavaScript, client)
for (var a=0;a<Table1._ActionItemGrp.count;a++){
for (var b=0;b<Table1.ActionItemGrp.all.item(a)._Row5.count;b++) {
if (Table1.ActionItemGrp.all.item(a).Row5.all.item(b).ClosedDate.rawValue!==null)
Table1.ActionItemGrp.all.item(a).presence="hidden";
}
}
Views
Replies
Total Likes
Hi,
as the element ActionItemGrp is a subform Set you won't be able to contoll its presence only those of its children (row3 etc.).
for (var a = 0; a < Table1._ActionItemGrp.count - 1; a += 1) {
var aTarget = xfa.resolveNode("Table1.ActionItemGrp[" + a + "]");
if (!aTarget.Row5.ClosedDate.isNull) {
aTarget.Row3.presence = "hidden";
aTarget.Row4.presence = "hidden";
aTarget.Row5.presence = "hidden";
aTarget.Row6.presence = "hidden";
}
}
To make this work event with only one instance of the ActionItemGrp you have to remove the min occurences in its binding tab.
Hope this helps.
Views
Replies
Total Likes
Blog post here that may help:
http://www.truetechtroubleshooting.com/2014/02/basic-javascript-looping-in-adobe.html
Views
Replies
Total Likes
Even when removing the minimum occurrences, the script will not hide the first occurence. It does hide the others.
Views
Replies
Total Likes
For me it worked.
Share your current form, so I'll will check, what's wrong.
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi,
there was a bug in the script I've posted before.
Here's the corrected one.
for (var a = 0; a < Table1._ActionItemGrp.count; a += 1) {
var aTarget = xfa.resolveNode("Table1.ActionItemGrp[" + a + "]");
if (!aTarget.Row5.ClosedDate.isNull) {
aTarget.Row3.presence = "hidden";
aTarget.Row4.presence = "hidden";
aTarget.Row5.presence = "hidden";
aTarget.Row6.presence = "hidden";
}
}
Views
Replies
Total Likes
radzmar,
I appreciate your help. The new script does work now to close the first occurence in the first topic but if i click to create a second topic, it does not hide any of the Action Items in that second topic section.
Views
Replies
Total Likes
Ah ok.
That's tricky but this script should do it.
for (var t = 0; t < _Table1.count; t += 1) {
for (var a = 0; a < xfa.resolveNode("Table1[" + t + "]")._ActionItemGrp.count; a += 1) {
var aTarget = xfa.resolveNode("Table1[" + t + "].ActionItemGrp[" + a + "]");
if (!aTarget.Row5.ClosedDate.isNull) {
aTarget.Row3.presence = "hidden";
aTarget.Row4.presence = "hidden";
aTarget.Row5.presence = "hidden";
aTarget.Row6.presence = "hidden";
}
}
}
Views
Replies
Total Likes
Fantastic! Thank you so very much for all your help!
-Don
Views
Replies
Total Likes