Copy link to clipboard
Copied
I just finished testing a section of my form and now all of a sudden the script isn't working and I'm getting console errors????
This section has a serious of checkboxes which either instruct the user to Continue to the next section or Stop. The sections are semi-hidden by a 50% transparent gray rectangle annotation until the user checks the Continue box. If the continue box is unchecked the gray rectangle reappears. The checkboxes also turn certain fields on and off underneath the gray rectangle. I used the following code and it worked great about two hours ago:
if(event.target.isBoxChecked(0))
{
showHide("B1.txt.SFM.Receive.Go");
EnableField("B1.SFM.Location");
this.getAnnot(0,"B1.2.Rect").hidden = true;
}
if(event.target.value=="Off")
{
showHide("B1.txt.SFM.Receive.Go");
DisableField("B1.SFM.Location");
this.getAnnot(0,"B1.2.Rect").hidden = false;
}
showHide, EnableField and DisableField are document level functions which toggle fields on and off. That part is still working fine.
But the rectangles don't change and I just get an error in the console now: this.getAnnot(...) is null
??
Check if annot name is right.
Do you have multiple pages? because if annot is not on first page you need to change '0' to '1' if it's on second page or '2' if it's on third page ...etc this.getAnnot(0,"B1.2.Rect").hidden = true;
Copy link to clipboard
Copied
Is it an annotation or a field?
Copy link to clipboard
Copied
An annotation. A gray rectangle
Copy link to clipboard
Copied
Try adding this line before using getAnnot:
this.syncAnnotScan();
Copy link to clipboard
Copied
Check if annot name is right.
Do you have multiple pages? because if annot is not on first page you need to change '0' to '1' if it's on second page or '2' if it's on third page ...etc this.getAnnot(0,"B1.2.Rect").hidden = true;
Copy link to clipboard
Copied
How did you set the annotation name?
Copy link to clipboard
Copied
I set the name in the console using:
this.selectedAnnots[0].name = "B1.2.Rect";
I think the immediate problem was the page numbers, although I'm confused about why it worked for a while and then stopped working.
I am still wondering if I need to also address any of the following:
1) Maybe I need to change the name so it doesn't end with .rect
2) Should I also add:
this.syncAnnotScan();
before getAnnot
3) Should I set a document level variable first:
var annot = this.getAnnot(pg#,"AnnotationName");
and then use annot.hidden = true in my calculation script