JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Range Validators

A range validator tests if the value of a data-entry control is inside a specified range of values. You use three main properties here-the ControlToValidate property contains the data-entry control to validate, and the MinimumValue and MaximumValue properties hold the minimum and maximum values of the valid range. If you set one of the MinimumValue and MaximumValue properties, you also must set the other. Also, don't forget to set the Type property to the data type of the values to compare; the possible values are the same as for comparison validators.

There's a range validator next to the third text box in Figure 18.2-this validator is checking to make sure that the applicant's age is between 18 and 150. As you can see, range validators can be useful for all kinds of ranges, from temperatures to number of items in stock, allowing you, for example, to make sure that the temperature in a freezer is less than freezing, or the number of items in a purchase order is greater than zero.

Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor