| 1 |
lars |
1 |
<com:TContent ID="body">
|
|
|
2 |
|
|
|
3 |
<h1>TRequiredFieldValidator Samples</h1>
|
|
|
4 |
|
|
|
5 |
<table class="sampletable">
|
|
|
6 |
|
|
|
7 |
<tr>
|
|
|
8 |
<td class="samplenote">
|
|
|
9 |
Validator with default settings:
|
|
|
10 |
</td>
|
|
|
11 |
<td class="sampleaction">
|
|
|
12 |
<com:TTextBox ID="TextBox1" />
|
|
|
13 |
<com:TRequiredFieldValidator
|
|
|
14 |
ValidationGroup="Group1"
|
|
|
15 |
ControlToValidate="TextBox1"
|
|
|
16 |
Text="Field required." />
|
|
|
17 |
<com:TButton Text="Submit" ValidationGroup="Group1" />
|
|
|
18 |
</td>
|
|
|
19 |
</tr>
|
|
|
20 |
|
|
|
21 |
<tr>
|
|
|
22 |
<td class="samplenote">
|
|
|
23 |
Validator with client-side validation disabled:
|
|
|
24 |
</td>
|
|
|
25 |
<td class="sampleaction">
|
|
|
26 |
<com:TTextBox ID="TextBox2" />
|
|
|
27 |
<com:TRequiredFieldValidator
|
|
|
28 |
ValidationGroup="Group2"
|
|
|
29 |
EnableClientScript="false"
|
|
|
30 |
ControlToValidate="TextBox2"
|
|
|
31 |
Text="Field required." />
|
|
|
32 |
<com:TButton Text="Submit" ValidationGroup="Group2" />
|
|
|
33 |
</td>
|
|
|
34 |
</tr>
|
|
|
35 |
|
|
|
36 |
<tr>
|
|
|
37 |
<td class="samplenote">
|
|
|
38 |
Validator with focus-on-error enabled and dynamic display:
|
|
|
39 |
</td>
|
|
|
40 |
<td class="sampleaction">
|
|
|
41 |
<com:TTextBox ID="TextBox3" />
|
|
|
42 |
<com:TRequiredFieldValidator
|
|
|
43 |
ValidationGroup="Group3"
|
|
|
44 |
Display="Dynamic"
|
|
|
45 |
ControlToValidate="TextBox3"
|
|
|
46 |
FocusOnError="true"
|
|
|
47 |
Text="Field required." />
|
|
|
48 |
<com:TButton Text="Submit" ValidationGroup="Group3" />
|
|
|
49 |
</td>
|
|
|
50 |
</tr>
|
|
|
51 |
|
|
|
52 |
<tr>
|
|
|
53 |
<td class="samplenote">
|
|
|
54 |
Validating if initial value (test) is changed:
|
|
|
55 |
</td>
|
|
|
56 |
<td class="sampleaction">
|
|
|
57 |
<com:TTextBox ID="TextBox4" Text="test" />
|
|
|
58 |
<com:TRequiredFieldValidator
|
|
|
59 |
ValidationGroup="Group4"
|
|
|
60 |
Display="Dynamic"
|
|
|
61 |
ControlToValidate="TextBox4"
|
|
|
62 |
InitialValue="test"
|
|
|
63 |
Text="Input must not be 'test'." />
|
|
|
64 |
<com:TButton Text="Submit" ValidationGroup="Group4" />
|
|
|
65 |
</td>
|
|
|
66 |
</tr>
|
|
|
67 |
|
|
|
68 |
<tr>
|
|
|
69 |
<td class="samplenote">
|
|
|
70 |
Validating if checkbox is checked:
|
|
|
71 |
</td>
|
|
|
72 |
<td class="sampleaction">
|
|
|
73 |
<com:TCheckBox ID="CheckBox" Text="agree" />
|
|
|
74 |
<com:TRequiredFieldValidator
|
|
|
75 |
ValidationGroup="Group5"
|
|
|
76 |
Display="Dynamic"
|
|
|
77 |
ControlToValidate="CheckBox"
|
|
|
78 |
Text="You must agree." />
|
|
|
79 |
<com:TButton Text="Submit" ValidationGroup="Group5" />
|
|
|
80 |
</td>
|
|
|
81 |
</tr>
|
|
|
82 |
|
|
|
83 |
<tr>
|
|
|
84 |
<td class="samplenote">
|
|
|
85 |
Validating if a selection has been made in a dropdown list:
|
|
|
86 |
</td>
|
|
|
87 |
<td class="sampleaction">
|
|
|
88 |
<com:TDropDownList ID="DropDownList">
|
|
|
89 |
<com:TListItem Value="value 1" Text="text 1" Selected="true" />
|
|
|
90 |
<com:TListItem Value="value 2" Text="text 2" />
|
|
|
91 |
<com:TListItem Value="value 3" Text="text 3" />
|
|
|
92 |
</com:TDropDownList>
|
|
|
93 |
<com:TRequiredFieldValidator
|
|
|
94 |
ValidationGroup="Group6"
|
|
|
95 |
ControlToValidate="DropDownList"
|
|
|
96 |
InitialValue="value 1"
|
|
|
97 |
Text="A selection must be made." />
|
|
|
98 |
<com:TButton Text="Submit" ValidationGroup="Group6" />
|
|
|
99 |
</td>
|
|
|
100 |
</tr>
|
|
|
101 |
|
|
|
102 |
<tr>
|
|
|
103 |
<td class="samplenote">
|
|
|
104 |
Validating if a selection has been made in a dropdown list:
|
|
|
105 |
</td>
|
|
|
106 |
<td class="sampleaction">
|
|
|
107 |
<com:TListBox ID="ListBox">
|
|
|
108 |
<com:TListItem Value="value 1" Text="text 1" />
|
|
|
109 |
<com:TListItem Value="value 2" Text="text 2" />
|
|
|
110 |
<com:TListItem Value="value 3" Text="text 3" />
|
|
|
111 |
</com:TListBox>
|
|
|
112 |
<com:TRequiredFieldValidator
|
|
|
113 |
ValidationGroup="Group7"
|
|
|
114 |
ControlToValidate="ListBox"
|
|
|
115 |
Text="A selection must be made." />
|
|
|
116 |
<com:TButton Text="Submit" ValidationGroup="Group7" />
|
|
|
117 |
</td>
|
|
|
118 |
</tr>
|
|
|
119 |
|
|
|
120 |
</table>
|
|
|
121 |
|
|
|
122 |
<div class="last-modified">$Id: Home.page 1650 2007-01-24 06:55:32Z wei $</div></com:TContent>
|