Edit Custom JavaScript in an External Editor

You can view and edit the custom JavaScript for a form within Form Studio, using the built-in Script Editor, or using an external text editor, such as Notepad++.

 

By default , Form Studio uses its built-in Script Editor to edit the Script file containing your custom JavaScript functions. However, you can choose to edit the file in an external editor, such as Notepad++, if you prefer. You can edit the Script file from the Properties Pane or Project Explorer within Form Studio or you can open the file directly within an external editor itself, in the standard manner for your chosen editor.

The name of the current editor is displayed on the Status Bar at the bottom of the Form Studio window.

  • You can only edit the Script file in one editor at once, you can't edit it in both the built-in Script Editor and an external editor at the same time.

 

By default, a form's custom JavaScript file can be found in the following location:

C:\Users\<user name>\Documents\NDL Software\Form Studio\Projects\<project name>\CustomScripts

and will have a name looking something like this:

a1b2a1b2-1111-aaaa-2222-a1b2a1b2a1b2_custom.js

 

When you open a project in Form Studio, a copy of each form's Script file is made in the same folder as the Script files. These copies has the same name as the original files with _copy appended to the end of the file name, e.g.:

a1b2a1b2-1111-aaaa-2222-a1b2a1b2a1b2_custom_copy.js

When you edit a Script file from within Form Studio, whether you use the built-in Script Editor or an external editor, it is the file copy which is edited. The original file is then overwritten by the copy when the project is saved in Form Studio. The copy is deleted when you close the project. This means that if you close the project without saving changes, you will lose your Script changes because the edited copy will be deleted without overwriting the original file first.

 

 

If you are editing the Script file in an external editor and you want to make changes to an Element's Event or Rules properties within Form Studio, we recommend you close the file (saving any changes) in the external editor before you make the changes in the Studio. If the changes result in the Studio opening the Script file, it will be opened using the current editor.

Likewise, if you are editing the Script file in an external editor and you want to change to view it within Form Studio, close down the external editor, saving any changes if necessary, before you open the file in the Studio.

 

If you change the editor you are using to edit the Script file, the new editor will become the current editor and will be used the next time you edit the file, if you don't specify a different editor. When you save your project, the name of the current editor is saved along with any changes and so will be retained when you close your project. If you don't save your project before closing it, the name of the current editor will revert to that in use at the time of the last save or when the project was opened. Each project stores its own current editor value.

 

 


See also:

Customise Forms with JavaScript

Edit Custom JavaScript

The Script Editor

Writing Scripts

Advanced Scripting for JavaScript Developers