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

Where is the Javascripts\aform.js files on a Mac

Evan Goldstein
Registered: Aug 30 2010
Posts: 21

Hi,
 
I'm trying to learn and incorporate Javascript in Adobe Forms, the manual "Using Acrobat Javascript in Forms" references Javascripts\aform.js often. Where can I find these files on the Mac.
 
Thanks,
Evan

My Product Information:
Acrobat Pro, Macintosh
George_Johnson
Online
Expert
Registered: Jul 6 2008
Posts: 1876
That file is no longer present since several versions ago.

If you're looking to install your own folder-level JavaScript files and need to know where to put them, you can use the app.getPath JavaScript method. For a bit more information, see: There is a tutorial http://acrobatusers.com/tutorials/2006/where_js_goes

as well as the Acrobat JavaScript documentation.
Evan Goldstein
Registered: Aug 30 2010
Posts: 21
Thank you George for the link, but I am looking for guidance and example scripts to manipulate data in form fields. The manual mentions several examples in the Javascript\aform.js location.
Do these examples no longer exist?
Or can you point me to some?

Thanks,
Evan
George_Johnson
Online
Expert
Registered: Jul 6 2008
Posts: 1876
Those routines exist, but they are now in a compiled binary file. You can still see the code if you know the variable or function names using the JavaScript console. For example, to see the code of the AFMergeChange function, open the JavaScript console (Command+J) and type:

AFMergeChange

and hit Enter key on the numeric keypad and it will show:

function AFMergeChange(event) {
var prefix, postfix;
var value = event.value;
if (event.willCommit) {
return event.value;
}
if (event.selStart >= 0) {
prefix = value.substring(0, event.selStart);
} else {
prefix = "";
}
if (event.selEnd >= 0 && event.selEnd <= value.length) {
postfix = value.substring(event.selEnd, value.length);
} else {
postfix = "";
}
return prefix + event.change + postfix;
}


Note that any comments, which can be helpful, are removed. Also, the numeric keypad Enter will not work on Macs without a full keyboard. There is a workaround using a software keyboard, but I'd have to check out my Mac and get back to you with the details.
Evan Goldstein
Registered: Aug 30 2010
Posts: 21
That worked, thanks.
Can you point me towards the best place to get real world examples of javasripts to use with Arobat Forms?
I don't know javascript but want to learn and apply to my Forms by example.

Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi Evan,

Besides the more than 65 JavaScript tutorials provided in the Learning Center (many include sample files for download)here at AUC, my company's membership site pdfscripting.com is the most comprehensive resource for Acrobat JavaScript training and samples, for both AcroForms and LiveCycle Designer PDF forms. It's not free, but if you want to learn it's a good investment. The site does have a lot of free content so you can get an idea of the kinds of content available.Hope this helps,

Dimitri
Evan Goldstein
Registered: Aug 30 2010
Posts: 21
Thank you Dimitri, I will look into it.