summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.page
blob: c70e04c7fd07ae175e9b744db369b3571a1b17e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<com:TContent ID="body">
	<h1>Validator Toggle - Server and Client Side</h1>
	<com:TLabel ForControl="text1" Text="Text 1:" />
	<com:TTextBox ID="text1" />
	<com:TRequiredFieldValidator
		ID="validator1"
		ControlToValidate="text1"
		ErrorMessage="Text 1 is required" />
	<div>
	<com:TCheckBox ID="check1" Text="More..." />
	</div>

	<com:TPanel ID="panel1" Style="display:none" >
		<com:TLabel ForControl="text2" Text="Text 2:" />
		<com:TTextBox ID="text2" />

	<com:TRequiredFieldValidator
		ID="validator2"
		ControlToValidate="text2"
		OnValidate="validator2_onValidate"
		OnPreRender="validate2_onPostValidate"
		ErrorMessage="Text 2 is required">
	<prop:ClientSide.OnValidate>
		sender.enabled = $("<%= $this->check1->ClientID %>").checked;
	</prop:ClientSide.OnValidate>
	</com:TRequiredFieldValidator>

	</com:TPanel>

	<com:TButton ID="button1" Text="Submit!" />

	<com:TClientScript>
	Event.OnLoad(function()
	{
		Event.observe("<%= $this->check1->ClientID %>", "click", function(ev)
		{
			$("<%= $this->panel1->ClientID %>").toggle();
		});
	});
	</com:TClientScript>
<div class="last-modified">$Id$</div></com:TContent>