HOW TO

Validate an ArcGIS for Local Government JavaScript configuration file

Last Published: April 25, 2020

Summary

The ArcGIS for Local Government web applications have started to use JavaScript-based configuration files so that the contents of the file may be checked using JavaScript validation tools. This can be very helpful for troubleshooting or for finding errors such as missing JavaScript punctuation.

Instructions provided describe how to validate these configuration files.

Procedure

Any JavaScript validation tool may be used. In general, one submits the configuration file to the validator or copies the contents of the configuration file into a form on a validation web site. One repeats the cycle of editing and validating until validation is successful.

The procedure below shows an example using a validation website called JSLint.

Because JSLint also concerns itself with JavaScript formatting, formatting complaints can obscure true JavaScript errors. In order to be able to run JSLint and get no errors, we recommend that the configuration file's JavaScript be first run through a formatter to 'beautify' it. An example beautifier website is JSBeautifier.

  1. Go to the JSBeautifier website and paste the configuration file’s contents into the box that has brown text beginning with '// This is just a sample script...'
    [O-Image]
  2. Uncheck the 'Preserve empty lines?' option, and click the 'Beautify JavaScript or HTML' button to format the contents.
  3. Select the formatted contents (CTRL+A) and copy them.
  4. Go to the JSLint web site and paste the formatted contents into the box that has the light text '// Paste quality code here'.
    [O-Image]
    Note:
    This text may not be visible in all browsers.

  5. Near the bottom of the JSLint screen, type 'dojo' (without quotes) into the box that has the light text 'predefine global variables here'.
    [O-Image]
    Note:
    This text may not be visible in all browsers.

  6. Click the large blue button labeled 'JSLint'.
  7. Repeat steps 1 through 6 until JSLint doesn't report any errors.

    Note:
    For removing errors, it is helpful to have a text editor available that allows jumping to line numbers.

Article ID:000011599

Software:
  • ArcGIS for Local Government

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic