<Validate type="range">

The Validate tag whose type is set to "range" is referred to as a Range Validator and is used to ensure the value of the target control falls within the specified range of values. This can be used, for example, to ensure that only a limited number of tickets can be purchased - that the number of tickets ordered is at least one but not more than five.

Syntax

<Validate
    BackColor="color name|#dddddd"
    BorderColor="color name|#dddddd"
    BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge| Inset|Outset"
    BorderWidth="size"
    CssClass="string"
    DataType="String|Integer|Double|Date|Currency"
    Display="Static|Dynamic"
    EnableClientScript="True|False"

    Font-Bold="True|False"
    Font-Italic="True|False"
    Font-Names="string"
    Font-Overline="True|False"
    Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium| Large|X-Large|XX-Large"
    Font-Strikeout="True|False"
    Font-Underline="True|False"
    ForeColor="color name|#dddddd"
    Height="size"
    MaximumValue="string"
    Message="string"
    MinimumValue="string"
    Target="string"
    Text="string"
    Type="Range"
    Width="size"
/>
 
 

Remarks

When the "type" attribute is set to range, the control prevents the form from being submitted if its associated control's value does not match the regular expression pattern specified in the "validationexpression" attribute. You associate a control with the <validate> tag by setting its "target" attribute to the ID of the control you wish to validate. The "message" attribute is the text that will be displayed to the user when validation fails. If you are using the <validationsummary> tag, then you can also supply a "text" attribute. When validation fails, the "text" will be displayed where your <validate> tag is and the "message" will be displayed in the <validationsummary>.

Back to top

Example

<addform>
  ...
  <table>
    <tr>
      <td>
        <label for="txtQuantity" text="Number of Tickets" />
        <textbox id="txtQuantity" datafield="Quantity" datatype="int32" />
        <validate type="range" target="txtQuantity" minimumvalue="1" maximumvalue="5" message="You can only order between 1 and 5 tickets" datatype="Integer"/>
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <addbutton text="Place Order"/>&nbsp;<cancelbutton text="Cancel"/>
      </td>
    </tr>
  </table>
</addform>
Back to top