You are here: Skip Navigation Linksxnodesystems.com > Products > XField Suite > Boolean Field

Boolean Field - ASP.NET Web control for boolean value data entry and validation

Boolean Field is an ASP.NET Web control rendered as a labeled check box that is used to enter, display and validate boolean value.

Implementation

Boolean Field is implemented by the BooleanField class.

Documentation

Click here to see the documentation of the BooleanField class.

Validations

Boolean Field supports validations in the following execution order.

  • Compare to value validation
  • Compare to control validation
  • Custom validation

Custom Validation

Boolean Field supports custom validation at both client-side and server-side. To setup the custom validation error message, use the BooleanField.CustomValidation.Message property; to setup client-side custom validation, use the BooleanField.CustomValidation.ClientValidator property to specify the name of a JavaScript function that is used to perform client-side custom validation; to setup server-side custom validation, handle the server-side CustomValidate event.

The custom client validator function must take one parameter which in run-time will receve the validation context as a JSON object in the following format:

{"source":checkBoxId, "data":checked, "callback":callbackFunction}.

Here the "source" contains the id of the check box; "data" contains the checked status of the check box; "callback" contains a function that can be used during asynchronous custom validation to notify the XField's Client Validation Engine about the result of the validation.

To perform synchronous custom validation, add validation logic in the custom client validator you provide, and return a boolean value to indicate whether the field data passes the validation or not.

To perform asynchronous (Ajax) custom validation, first save the callback function somewhere (typically in a global variable); then setup Ajax call to the server-side to handle custom validation. After the Ajax call completes, notify the XField's Client Validation Engine about the result of the validation by invoking the saved callback with a boolean value to indicate whether the field data passes the validation or not.

View Custom Validation Demo of Boolean Field.

Go to top