Using a MetaScript array, a list of items can be generated one time and the list reused across your Virtual Ticket or Digital Storage Manager forms. The script is easy to write and can save the time spent manually entering the values, much in the same way a dynamic popup list works.
To create a static list of values using an array, perform the following:
- Open a desired form in the forms editor and choose Global MetaScript from the Format menu.
- Enter the following script into the Global MetaScript window:
|var myList = new Array("Joe", "Steve", "Bob", "Sally", "Mike");|
- Close the MetaScript window to save your script.
- Place a popup field onto your form. Click the Value arrow and choose Custom.
- Enter getList(); into the expression window.
- Save your form and test.
To use this item across multiple forms:
- Open a text editor and copy and paste the script into the text file.
- Save the file with a .js extension. Drag and drop the file into the Stored Scripts area of the Setup menu (DSM - Administration Menu).
- For each form which the script should be used on, enter the following in the Global MetaScript window to reference the Stored Script:
- This statement tells the application to use scripts from the yourscripts.js file which has been added to the database.
- Repeat step 5 from the previous section to specify the function to be used in your popup menus.