NumberEdit.Validate

Syntax

Validate: function(sender,args)

Parameters

sender. Event source.

args. Event information.

Description

The Validate event is fired during checking the entered data for validity.

Comments

Arguments of the Validate event are implemented by the NumberEditValidateArgs class.

Example

To execute the example, connect the PP.js library and the PP.css visual styles table on the HTML page. Create a value editor named NE. Add the OnValidate function that handles the event Validate:

<script type="text/javascript">

    NE = new PP.Ui.NumberEdit({

            ParentNode: document.getElementById("NE1"),

            Width: "170px",

            Height: "21px",

            Validate: OnValidate//Add event handler

        });

function OnValidate(sender, args) {//Create a function to handle the Validate event

            var i = args.Value;

            if (i > 1000 || i < -1000)

            {

                args.IsValid = false;

                alert("Validation failed");

            }

        }

</script>

After executing the example on entering a value greater than 1000 or less than -1000, the "Validation failed" message appears in the screen.

See also:

NumberEdit