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

Alert Dialog Box

JohnR
Registered: Apr 25 2007
Posts: 13

I'm trying to create a simple alert dialog box, but I'm quite a new beginner to Javascripting.

This is what I have attached to a button in Acroform (Acrobat Pro 9.0 - MAC Os) - Trigger - Mouse Up, Action - Run Javascript

It appears not to like line 7. I'd like it to display an alert with the modified path.

var Account = this.getField("Account");
var Template = this.getField("DABTemplate");

var TempName = DABTemplate.toString().substr(6,8)
var Path = “///Volumes/DocumentStore”;

var TotalPath = Path + “/" + "Display Ad Templates ” + TempName;

app.alert({
cMsg: TotalPath
});

I'm really new to JS, so I beg your patience and help.

thanks

John

My Product Information:
Acrobat Pro 9.2, Macintosh
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
It looks like DABTemplate is the name of one of your fields. It cannot be used direclty to extract a value from a form field. The value of this field is

Template.value

Use this in the "substr" operation.

Also several of your quotes appear not to be standard ASCII quotes, this will definately cause problems.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

JohnR
Registered: Apr 25 2007
Posts: 13
Thom, that's very helpful. I realized smart quotes are trouble. I also implemented template.value

Unfortunately, I seem to get no response from the pdf. Perhaps pdf javascripting doesn't throw run time exceptions to dysfunctional scripts?

thanks again
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Have you looked in the console window? In fact I'd suggest developing your code in the console before placing it in document. That way you can test each line individually.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script