We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.
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:
this.getAnnot(0,"B1.2.Rect").hidden = true;
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
Is it an annotation or a field?
An annotation. A gray rectangle
Try adding this line before using getAnnot:
Copy link to clipboard
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;
How did you set the annotation name?
I set the name in the console using:
this.selectedAnnots.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:
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