summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/tests/RequiredFieldValidator.html
blob: ae99d3550753ed1696930ecef0d2e473ed66e3a2 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
	<meta http-equiv="Content-Style-Type" content="text/css" />
    <title>Prado Client-Side RequiredFieldValidator Tests</title>
<style type="text/css">
/*<![CDATA[*/

	.message
	{
		color: red;
	}
	.required
	{
		border: 1px solid red;
	}
/*]]>*/
</style>

  </head>

  <body>
    <h1>Prado Client-Side RequiredFieldValidator Tests</h1>

<form action="" method="post" enctype="multipart/form-data" id="form1">
<script type="text/javascript" src="../../js/base.js"></script>
<script type="text/javascript" src="../../js/dom.js"></script>
<script type="text/javascript" src="../prado/validation.js"></script>
<script type="text/javascript" src="../prado/validators.js"></script>

	
<!-- group 1 -->
<div id="summary1"></div>
<div>
	<input id="text1" name="text1" type="text" value=""/>
	<span id="validator1" class="message" style="display:none;"><a href="#text1" onclick="javascript:Prado.Validation.Util.focus('text1'); return false;" >text1!</a></span>

	<span><input id="check1" type="checkbox" name="check1"/></span>
	<span id="validator2" class="message" style="display:none;">check 1!</span>
	
	<input id="submit1" type="submit" name="submit1" value="Group1"></input>

</div>
<!-- group 2 -->
<div id="summary2"></div>
<div>
	<input id="text2" name="text2" type="text" value=""/>
	<span id="validator3" class="message" style="visibility:hidden;">text2!</span>

	<span><input id="check2" type="checkbox" name="check2"/></span>
	<span id="validator4" class="message" style="visibility:hidden;">check 2!</span>
	
	<input id="submit2" type="submit" name="submit2" value="Group2"></input>

</div>

<div id="summary3"></div>


<input id="submit3" type="submit" name="submit3" value="Submit All"></input>
<input id="submit4" type="submit" name="submit4" value="Submit By Pass"></input>



<script type="text/javascript">
//<![CDATA[

			if(typeof(Prado) == 'undefined')
				alert("Unable to find Prado javascript library '../../base.js'.");
			else if(Prado.Version != 2.0) 
				alert("Prado javascript library version 2.0 required.");
			else if(typeof(Prado.Validation) == 'undefined')
				alert("Unable to find validation javascript library '../../validator.js'.");				
			else
				Prado.Validation.AddForm('form1');				
			
new Prado.Validation.Summary({id:"summary1", form:"form1", displaymode:"BulletList", group:"group1"});
new Prado.Validation(Prado.Validation.TRequiredFieldValidator, {id:"validator1", controltovalidate:"text1", errormessage:"<a href=\"#text1\" onclick=\"javascript:Prado.Validation.Util.focus(\'text1\'); return false;\" >text1!</a>", display:"Dynamic", controlcssclass:"required", initialvalue:""});
new Prado.Validation(Prado.Validation.TRequiredFieldValidator, {id:"validator2", controltovalidate:"check1", errormessage:"check 1!", display:"Dynamic", controlcssclass:"required", initialvalue:""});
Prado.Validation.AddGroup({id:"group1", target:"submit1"}, ["validator1", "validator2"]);
Prado.Validation.AddTarget('submit1');

new Prado.Validation.Summary({id:"summary2", form:"form1", displaymode:"BulletList", group:"group2"});
new Prado.Validation(Prado.Validation.TRequiredFieldValidator, {id:"validator3", controltovalidate:"text2", errormessage:"text2!", controlcssclass:"required", initialvalue:""});
new Prado.Validation(Prado.Validation.TRequiredFieldValidator, {id:"validator4", controltovalidate:"check2", errormessage:"check 2!", controlcssclass:"required", initialvalue:""});
Prado.Validation.AddGroup({id:"group2", target:"submit2"}, ["validator3", "validator4"]);
Prado.Validation.AddTarget('submit2');

new Prado.Validation.Summary({id:"summary3", form:"form1", displaymode:"BulletList"});
Prado.Validation.AddTarget('submit3');
//]]>
</script>
</form>