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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
<!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 RequiredListValidator Tests</title>
<!-- base files -->
<script type="text/javascript" src="../../base.js"></script>
<script type="text/javascript" src="../prototype/dom.js"></script>
<script type="text/javascript" src="../extended/dom.js"></script>
<script type="text/javascript" src="../prototype/event.js"></script>
<script type="text/javascript" src="../extended/event.js"></script>
<script type="text/javascript" src="../prototype/form.js"></script>
<script type="text/javascript" src="../prototype/position.js"></script>
<script type="text/javascript" src="../prototype/string.js"></script>
<script type="text/javascript" src="../extra/getElementsBySelector.js"></script>
<script type="text/javascript" src="../extra/behaviour.js"></script>
<script type="text/javascript" src="../prado/validation.js"></script>
<script type="text/javascript" src="../prado/validators.js"></script>
<style type="text/css">
/*<![CDATA[*/
.message
{
color: red;
}
.required, .required1, .required2
{
border: 1px solid red;
}
.requirede
{
background-color: red;
}
/*]]>*/
</style>
</head>
<body>
<h1>Prado Client-Side RequiredListValidator Tests</h1>
<form id="form1" action="#">
<!-- group 1 -->
<div>
<div id="checks">
<input type="checkbox" id="check1" name="check1[]" value="1" />1
<input type="checkbox" id="check2" name="check1[]" value="2" />2
<input type="checkbox" id="check3" name="check1[]" value="3" />3
<input type="checkbox" id="check4" name="check1[]" value="4" />4
<span id="validator1" class="message" style="display:none">Must select at least 1 and no more than 3</span>
</div>
<div>
<select id="select1" name="select1[]" multiple="multiple" size="5" style="width:10em">
<option value="one">one</option>
<option value="two">two</option>
<option value="three">three</option>
<option value="four">four</option>
<option value="five">five</option>
</select>
<span id="validator2" class="message" style="display:none">Must select at least 2 and no more than 3 and value "two"</span>
</div>
<input type="submit" value="Test" id="submit1" />
</div>
<script type="text/javascript">
<!--
/*]]>*/
if(typeof(Prado) != "undefined" && typeof(Prado.Validation) != "undefined")
{
Prado.Validation.AddForm("form1");
var val1 = {id : "validator1",
controltovalidate : "checks",
selector : "check1[]",
errormessage : "*",
display : "Dynamic",
controlcssclass : "required",
//elementcssclass : "requirede",
min : "1",
max : "3"
};
new Prado.Validation(Prado.Validation.TRequiredListValidator, val1);
var val1 = {id : "validator2",
controltovalidate : "select1",
selector : "select1[]",
errormessage : "*",
display : "Dynamic",
controlcssclass : "required",
//elementcssclass : "requirede",
min : "2",
max : "3",
required : "two"
};
new Prado.Validation(Prado.Validation.TRequiredListValidator, val1);
Prado.Validation.AddTarget("submit1");
}
/*]]>*/
//-->
</script>
</form>
</body>
</html>
|