<Validate type="checkbox">

The Validate tag whose type is set to "checkbox" is referred to as a CheckBox Validator and is used to ensure the user either checks or does not check a checkbox control.

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"
    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"
    Message="string"
    MustBeChecked="True|False"
    Target="string"
    Text="string"
    Type="Checkbox"
    Width="size"

/> 
 

Remarks

The checkbox validator is one type of the <validate> tag. When the "type" attribute is set to checkbox, the control prevents the form from being submitted if its associated checkbox control is checked or un-checked (depending on settings). 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>. The "display" attribute determines if the the <validate> tag will reserve space for its message in the page layout - typically resulting in blank space in your form -or whether it will dynamically allocate the space for the message when validation fails. The <validate> tag defaults to Dynamic display.
 

 

Back to top

Example

<addform>
  <submitcommand commandtext="INSERT INTO Users(FirstName, LastName) VALUES(@FirstName, @LastName)" />
    <table>
      <tr>
        <td>
          <label for="txtFirstName" text="First Name" />
          <textbox id="txtFirstName" datafield="FirstName" datatype="string" />
        </td>
      </tr>
      <tr>
        <td>
          <label for="txtLastName" text="Last Name" />
          <textbox id="txtLastName" datafield="LastName" datatype="string" />
        </td>
      </tr>
      <tr>

        <td>
          <label for="chkAgree" text="I Agree to the Terms of Service" />
          <checkbox id="chkAgree" datafield="Agree" datatype="boolean" />
<validate type="checkbox" target="chkAgree" mustbechecked="True" message="You must agree to the terms" />
        </td>
      </tr>
      <tr>
        <td colspan="2">
          <addbutton text="Add"/>&nbsp;<cancelbutton text="Cancel"/>
        </td>
      </tr>
    </table>
</addform>
Back to top