These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

NotAllowedError with Calendar Popup Script

resound
Registered: Jun 5 2009
Posts: 6
Answered

I have diligently pasted the scripts from the DatesExample2_extra.pdf into a different PDF. I only made a few changes. I removed the SetDate button, and put the mouse up action into a text field called weekStart instead. I also changed the date format to mm/dd/yy. Everything appears to be in order, but when I mouse up on the weekStart field the debugger states:

Exception in line 22 of function SetupK, script Document-Level:SetupK
Exception in line 3 of function top_level, script AcroForm:weekStart:Annot1:MouseUp:Action1
NotAllowedError: Security settings prevent access to this property or method.
Global.ThisDateField:22:AcroForm:weekStart:Annot1:MouseUp:Action1

SetupK script
function SetupK(DateField)
{
/*
var f = this.getField(DateField)
var sc = this.getField("ShowCalendar");
var myRect = f.rect;
var newRect = sc.rect;
var scWidth = newRect[2] - newRect[0];
var scHeight = newRect[1] - newRect[3];
*/
/* X[0] */
// newRect[0] = myRect[0];
/* Y[0] */
// newRect[1] = myRect[1] + 5;
/* X[1] */
// newRect[2] = newRect[0] + scWidth;
/* Y[1] */
// newRect[3] = newRect[1] + scHeight;
// sc.rect = newRect;
// sc.hidden = false;

/* Line 22: */ global.ThisDateField = DateField;

/* Line 24: */ }

weekStart script
/* Line 1: */ //this.getField("startWeek").value = util.printd("mm/dd/yy",new Date());

/* Line 3: */ SetupK("startWeek");

/* Line 5: */ PlaceCalendar(this.getField("startWeek"));

What gives? I don't think I'm asking Acrobat to do anything that should invoke a NotAllowedError. The document itself has no security settings on it.

Any suggestions?

Thanks in advance.

Jeremy

My Product Information:
Acrobat Pro 9.1.1, Macintosh
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Put back the button and the script for the button.

George Kaiser

resound
Registered: Jun 5 2009
Posts: 6
I've never been able to get this working. I stopped working on the project that needed this script several months ago, but now I have renewed interest in making it work. I wonder if other people are having the same problem. I always get the same exception:

Exception in line 21 of function SetupK, script Document-Level:SetupK()
Exception in line 3 of function top_level, script AcroForm:SetDate:Annot1:MouseUp:Action1
NotAllowedError: Security settings prevent access to this property or method.
Global.ThisDateField:21:AcroForm:SetDate:Annot1:MouseUp:Action1

It's always referring to this line of code in the SetupK() function:

global.ThisDateField = DateField;

Even the unmodified, original PDF example breaks on this. It can be found here:

http://www.acrobatusers.com/auc/content/tech_corners/javascript_corner/tips/2006/date_time_part2/DatesExample2_extra.pdf

or here:

http://www.planetpdf.com/forumarchive/143318.asp

Is there a fix for this (like a method to make it a trusted function), or is this just unfixable?

Thanks for any help you can provide in advance.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
It works with Acrobat 8 Professional and Acrobat 7 Standard. Since there are some complex field movements and the ability to access the rectangle of the field requires the PDF have 'Extended Form Rights' applied to use this feature in Reader.

Have you renamed any fields? If so, you will need to edit the field names in the scripts.

The script also does not adjust for leap years.

George Kaiser

resound
Registered: Jun 5 2009
Posts: 6
It looks like there is a checkbox to "Enable global object security policy" in Acrobat Pro 9. It was checked. The script works without exceptions with it unchecked.

I've decided to do my project with LiveCycle instead, but thanks for responding.