{dialog.object}setErrors Method

Syntax

{dialog.object}.setErrors(errorObj);

Arguments

errorsObjarray of objects

An array of objects that define an error message for a control on the component. Each entry in the array must define the following properties:

idstring

The id of the control that has the error.

messagestring

The error message for the control.

Description

Display error messages for fields in the UX component.

Discussion

The {dialog.object}.setErrors() method can be used with custom validation to report errors for controls in a UX Component. It is often used to add data validation and error report for Custom controls or user-defined Addin controls.

The method takes an array that contains one or more error objects that define the ID of the control with the error and an error message. For example:

var errors = [];

errors.push({id="{dialog.componentName}.V.R1.TXT1",message="Textbox cannot be blank"});
errors.push({id="{dialog.componentName}.V.R1.CHECKBOX1",message="No option selected."});

{dialog.object}.setErrors(errors);

To learn more about the {dialog.object}.setErrors() method is used with Custom controls, watch the video below.

Understanding CustomControls

The UX Component allows you to define two types of CustomControls - data bound and non-data bound. In both cases the HTML and Javascript for the custom control can either be specified at design-time, or (much more powerfully) generated by Xbasic at run-time.

In this video we introduce the CustomControl found in the 'Other Controls' category of the UX Builder (as opposed to the 'CustomControl' found in the 'Data Controls' category).

After introducing the basic concepts of the CustomControl, the video shows how a UX form can be dynamically generated at runtime from a definition that could be read from a database.

Download Component

2016-01-19

See Also