Stefan Cameron on Forms
Building intelligent forms using Adobe LiveCycle Designer

Setting JavaScript as the Default for New Forms

If you’ve ever written scripts in Designer, you will have noticed that the default scripting language is FormCalc which is a problem if you need to (or prefer) to write your scripts in JavaScript.

The easiest way to make sure that all your new scripts default to the JavaScript language is to use the Form Properties dialog and set JavaScript as the default scripting language (in the Defaults tab). The problem with this setting is that it affects only the current form. If you’re like me, you create lots of forms every day, you constantly forget that the default scripting language is FormCalc and you only remember once you’re running your form and you get a FormCalc error message box in Acrobat telling you that your syntax is incorrect. How annoying!

Fortunately, there’s a way to set JavaScript as the default scripting language for all new forms — based on a specific template. The default setting for the scripting language is actually specified as a processing instruction in the XML Source. If you create a new document and go to the XML Source tab, you’ll find the following processing instruction set as a child of the <template> element (also shown in the image below):

<?templateDesigner DefaultLanguage FormCalc?>

Since all new documents created in Designer are based on templates and that each template comes with its own set of processing instructions, modifying the processing instruction in the template would effectively modify the default scripting language on all new forms based on that template. Going one step further and making that modified template your default template would ensure makes things even easier when you’re creating new forms.

Fortunately, you don’t have go to the XML Source view to modify this processing instruction. Instead, you can set its value using the Form Properties dialog (accessible via the File menu): In the Defaults tab, set the Default Language property to “JavaScript”.

Modifying Designer Templates

In Designer, you use the Template Manager to organize your templates. You can access the Template Manager from the Tools menu.

To modify a template, you can follow these easy steps:

  1. Create a new document based on the template you wish to modify.
  2. Make the necessary modifications (like setting the processing instruction for the default scripting language setting to "JavaScript").
  3. Save the new document as an "Adobe LiveCycle Designer Template (*.tds)" file. If you want to replace an existing template (say "Letter"), use that same name as the file name for the new (modified) template file you’re saving.
  4. Using the Template Manager, select the tab pertaining to the group in which you want to add your new template. If you’re wanting to replace the "Letter" template, for example, select the "Standard" tab.
  5. Right-click in the list panel and select "Add Template…". Select the template you just saved and it’ll be added to Designer’s "template store". Note that if the name of your new template file is the same as an existing template in the group you selected (e.g. the "Letter" template in the "Standard" group), you’ll be prompted to overwrite the existing template.

One important thing to note in the way Designer handles templates is that any template file you add to the Template Manager gets copied into the "template store" which means that new documents based on that template aren’t actually based on the template file in the location where you saved it but rather on the copy that was placed in the "template store".

If you’re wondering what the "template store" is, it’s actually a folder inside Designer’s Application Data folder on your system. While I don’t encourage you to look in there (because you might see things that look interesting but you shouldn’t be playing with ;) , if you find them, then you should also be able to open them directly in Designer and modify them without having to create a separate copy.

Updated: January 17, 2006

Posted by Stefan Cameron on January 10th, 2007
Filed under Events,Script Editor,Scripting
Both comments and pings are currently closed.

4 Responses to “Setting JavaScript as the Default for New Forms”

  1. Boris Lenz on January 12th, 2007

    Hi Stefan,
    first – from the moment I stumbled upon your blog I really like it and I regularly forward the URL to my customers. (I do quite a lot of trainings working for Adobe Consulting in Germany)
    For this article I’d like to add, that it’s not really neccessary to do changes in the XML source of a form – you can use the form-properties dialog (FILE -> FORM PROPERTIES). On the secont tab you will find a drop down list to set the default language in the UI (FormCalc/JS). This will set the same property in the XML-Source of your XDP file – and you’ve just have to save and set it as mentioned as a standard .tds file.

    May be it’s noteworthy, that a .tds file will save all of your forms-settings, like units (inches/cm – very important here…), rulers, drawing-aids etc. etc and any form-elements you’ve left in the .tds file.



  2. Stefan Cameron on January 17th, 2007


    I’m glad to hear that my blog articles are proving to be useful!

    Thanks for pointing-out the fact that the default scripting language can be set using the Form Properties dialog. That’s certainly better than editing the XML Source directly.

    I have updated my post accordingly.

  3. Hugues on July 12th, 2007

    Good afternoon
    I work in an environement that uses Roaming profiles. Since installing Acrobat 8 professional i have run into issues with my profile.
    These issues relate to the default location of the designer 8 templates. can we chagne this location?

    Any news regarding this would be appreciated.

  4. Stefan Cameron on July 21st, 2007


    Unfortunately, there’s no way of making Designer look for templates elsewhere than in

    C:\\Documents and Settings\\<user>\\Application Data\\Adobe\\Designer\\8.0\\<languageID>