Syntax Checking in Static Server Pages

Uniface always performs server-side syntax checks when data in a static server page (USP) is submitted, but it is possible to enable browser-side syntax checking for some field syntax definitions.

For browser-side syntax checking to work in USPs, JavaScript must be enabled in the browser, and the browser must have a Java VM plug-in installed and enabled. If JavaScript is not enabled, the USP itself still works, but syntax will be checked by the server when the data is submitted, not in the browser.

Enabling Syntax Checking in the Browser

To enable browser-side syntax checking, uncomment the following code in the header of the default layout, or add it to your own layout:

<!-- Enable the following section to enable browser field syntax checking:-->
<x-option fieldcheck="true" />
<x-subst type="fieldcheck" name="javascript"></x-subst>
<x-subst type="fieldcheck" name="errormessages"></x-subst>
<x-subst type="fieldcheck" name="applet"></x-subst>

This will enable syntax checking for all fields that have field syntax definitions that are supported for browser-side checking.

Displaying Errors

If an error occurs during syntax checking, the error message is displayed in an alert box. The error message is retrieved from the server application using the $language and $variation settings applicable to that application.

The user removes the modal dialog box by clicking OK, and the focus is returned to the field where the error has occurred.

Related Topics