Validating Form Field Data

You can configure form fields so data is validated on the client side before the data is submitted to the server where the changes are committed.

For every form field, you can use either standard JavaScript validation or custom (user-defined) JavaScript validation. The emxUIFormHandler.js file contains JavaScript APIs that can be used for validation. This section describes both methods.

The following topics are discussed:

Standard JavaScript Validation

Using the format field setting, you can have field data validated when it is displayed in Edit mode and the Editable setting is true. For example, if a field has the setting format=integer, when the user clicks Done on the Edit Form page, the system validates this field's value to make sure it is an integer value. The valid values for the format setting are:


  • date
  • real
  • integer
  • numeric

The field value is also validated when the field includes the Required=true setting. The system displays an appropriate JavaScript message in case of invalid entries.

User Defined / Custom JavaScript Validation

You can use a custom JavaScript method to validate any field when it is displayed in Edit mode and the Editable setting is true.

The emxUIFormHandler.js file contains these methods that can be used for validation:


  • emxFormGetValue: Returns an object that holds the actual/display values for both the modified and old values of the field.
  • emxFormSetValue: Sets the displayed field value and actual field value.
  • emxFormGetFieldHTMLDOM: Gets the HTML DOM object for a field.
  • emxFormDisableField: Enables or disables a field (gray or ungray).
  • emxFormIsFieldEditable: Returns a boolean value indicating if the field can be edited.
  • emxFormSetFieldEditable: Sends true to make the field editable; or false to make the field non-editable.
  • emxFormReloadField: Reloads the specified field.

Refer to the JavaDocs for details on these functions.

Framework Validation FileENOVIA Business Process Services

The ENOVIA Business Process Services validation file is defined using the following property:

eServiceSuiteFramework.UIForm.ValidationFile = scripts/
emxUIFormValidation.js 

Or for backward compatibility:

emxFramework.UIForm.ValidationFile = scripts/
emxUIFormValidation.js 

emxUIFormValidation.js is common and is available to all the web form pages. It is distributed with ENOVIA Business Process Services. Any ENOVIA Business Process Services upgrade overwrites it. Currently, the file is empty and serves as a placeholder for future validation methods that may be needed for all applications. Do not change this file since it will get overwritten in future upgrades.

To add any common custom files to be available across all web forms used by different applications, add the custom files to this property. For example:

eServiceSuiteFramework.UIForm.ValidationFile =scripts/
emxUIFormValidation.js,  \ 

scripts/abcCustomValidation1.js

In this case scripts/abcCustomValidation1.js will not get overwritten by ENOVIA Business Process Services upgrades.

Application-Specific Validation File

You can define application-specific custom validation files using the property based on the Registered Suite (suite key) in emxSystem.properties. For example, if the Registered Suite is EngineeringCentral, the corresponding key is defined in the system property file as shown below:

EngineeringCentral.UIForm.ValidationFile = scripts/
emxEngrValidation.js

Or:

eServiceSuiteEngineeringCentral.UIForm.ValidationFile = 
scripts/emxEngrValidation.js

You can assign one or more files separated by a comma as the property value to define multiple files.