JavaScripTools Manual


Customizing the default values

On most scripts (all but JavaScriptUtil) there are values that can be customized, and assume a default value. Most of them can be customized using "constants" (they are actually variables following the Java constant name convention, that is, UPPERCASE_NAME). Those constants default value migth not be your use (for example: I am brazilian, so the parsers default formatting options reflect the brazilian conventions, like 1.234,56 and 31/12/2000).

The best way to set those default values is to create a JavaScript file containing only the redefinitions for the constants you want to redefine, and include that file after including the JavaScripTools scripts. Here is an example to customize the parsers default values for the US locale (assume the file is called defaults.js):


Then, include the script files (assume they are inside the js directory. If not, replace if to the correct path to the scripts):

<script src="js/JavaScriptUtil.js"/></script>
<script src="js/Parsers.js"/></script>
<script src="js/InputMask.js"/></script>
<script src="js/JavaScripTable.js"/></script>
<script src="js/defaults.js"/></script>

Another way is to directly change the default constant values, but it is not recommended, since it can only be applied on the uncompressed (original) scripts (it is VERY hard to find things on the compressed scripts), and every update on the JavaScripTools library would change those values back to the "factory default".

The file disposition on the release archive
Table of Contents Next:
Introduction to JavaScriptUtil