Acrobat User Community Forums

You are not logged in.     Log in to your AUC account.     Don't have an account? Sign up today

#1 2007-07-24 11:56:25

djjones
Member
Registered: 2007-07-24
Posts: 0

JavaScript in Document Actions

I'm trying to run a javascript in WillPrint Document Actions. A for loop is setup to count the text fields on the document, validate the value is not null and then change the border color when condition is true to transparent but nothing is working. The Debugger is setup and I get through errors but It's like something is is not turned on. Can you please help. I can send the script if need be.

Thanks
Deedee


My Product Information:
Acrobat Pro 7 / Windows

Offline

 

#2 2007-07-28 15:28:16

thomp
Member

Registered: 2007-04-23
Posts: 1027

Re: JavaScript in Document Actions

If your script is throwing exceptions then obviously it's not going to work.  It probably has nothing to do with the WillPrint event.  So yes, please post your code.

Offline

 

#3 2007-07-30 08:55:28

djjones
Member
Registered: 2007-07-24
Posts: 0

Re: JavaScript in Document Actions

Thanks Thom for your respones. As it turns out, I wasn't event getting in the the for loop in order to validate the text field boxes. It's working now. The script is posted below. Now I'm trying to put the boxes back via the "Clear" button and reset the fields once the form is printed. I thought I could simply use the same code and make the strokeColor my custom RGB, 255,191,170, but when I click the "Clear" button, it's removing more text boxes instead of adding them back to the form. You might be able to tell I'm a newbie at JavaScript, but I'm catching on a little.

WILLPRINT DOCUMENT ACTION script:
for ( var i = 0; i < this.numFields; i++)
{
var fname = this.getNthFieldName(i);

var f = this.getField(fname);
if (!(f.valueAsString == ''))
    {
            color.transparent = new Array("T")
    f.strokeColor = color.transparent
    };
};


CLEAR button script
for ( var i = 0; i < this.numFields; i++)
{
var fname = this.getNthFieldName(i);

var f = this.getField(fname);
if (f.valueAsString == " ")
    {
     colLtPink = new Array("RGB", 255,191,170)
    f.strokeColor = colLtPink
    };
};

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson

AcrobatUsers.com  >>  User Groups • News • Events • Articles • Blogs • How To • Resources • Member Log in