This project is read-only.

Validation, Required Fields

This example explains how to configure required fields. Field firstNameTextBox relies on the default error message, field lastNameTextBox uses the custom one.

See interactive example on http://www.redui.net

UI Model

{
    "windows": [
        {
            "name": "ValidationExample",
            "title": "Validation Example",
            "left": 500,
            "top": 100,
            "width": 400,
            "height": 300,
            "controls": [
                {
                    "name": "firstNameTextBox",
                    "type": "textbox",
                    "label": "First Name",
                    "bindsTo": "firstName",
                    "isRequired": true
                },
                {
                    "name": "lastNameTextBox",
                    "type": "textbox",
                    "label": "Last Name",
                    "bindsTo": "lastName",
                    "isRequired": true,
                    "validationErrorMessage": "Last Name was not provided"
                },
                {
                    "name": "OKButton",
                    "type": "button",
                    "text": "OK",
                    "isDialogButton": true,
                    "dialogResult": "OK"
                },
                {
                    "name": "CancelButton",
                    "type": "button",
                    "text": "Cancel",
                    "isDialogButton": true,
                    "dialogResult": "Cancel"
                }
            ]
        }
    ]
}

Data Model

var customerData = {
	firstName: "",
	lastName: "",
};

Code

var exampleWindow = redui.createNewWindow("ValidationExample");
exampleWindow.bind(customerData);
exampleWindow.show();


.

Last edited Dec 8, 2013 at 5:02 PM by artemkv, version 2

Comments

No comments yet.