Welcome Guest! To enable all features please Login or Register.



How to validate data objects on the UI
#1 Posted : Tuesday, October 2, 2012 6:13:28 PM(UTC)

When you edit a form bound to a Xomega data object, some of the data properties of the object may be validated automatically as you make changes to the fields. However, you still want to make sure that the object is validated before submitting its data via a service call. Xomega Framework makes validating UI data objects with all their properties and child objects extremely easy.

Here's a list of steps that you typically perform in this case.
  1. Call the Validate method on your data object with the force parameter set to true to revalidate the data objects, its properties and all child objects, even if they have been validated before. Each data property validates its own value(s), while the object may provide cross-field and other additional validations.
  2. After the validation, call the GetValidationErrors method on your data object to retrieve all errors and warnings that were generated during the validation process. The result is the ErrorList class from the Xomega Framework.
  3. Call the HasErrors message on the validation error list to test if it contains any errors. In this case, you can handle the errors according to your current error handling standards (e.g. by displaying them in a dialog), and stop further execution of the action.

The following snippet demonstrates these steps.
ErrorList valErr = dataObj.GetValidationErrors();
if (valErr.HasErrors())

To learn how to actually implement various validations in Xomega Framework, read the following topics.
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.