Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2150 mathias 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2
	"http://www.w3.org/TR/html4/strict.dtd">
3
<html>
4
	<head>
5
		<title>Test DateTextBox Widget</title>
6
 
7
 
8
		<script type="text/javascript" src="../../../dojo/dojo.js"
9
			djConfig="isDebug: true, parseOnLoad: true, extraLocale: ['de-de', 'en-us']"></script>
10
		<script type="text/javascript" src="../_testCommon.js"></script>
11
 
12
		<script type="text/javascript">
13
			dojo.require("dijit.form.DateTextBox");
14
			dojo.require("dojo.date.locale");
15
			dojo.require("dojo.parser");	// scan page for widgets and instantiate them
16
		</script>
17
		<style type="text/css">
18
			@import "../../../dojo/resources/dojo.css";
19
			@import "../css/dijitTests.css";
20
 
21
			.testExample {
22
				background-color:#fbfbfb;
23
				padding:1em;
24
				margin-bottom:1em;
25
				border:1px solid #bfbfbf;
26
			}
27
 
28
			.small {
29
				width: 3em;
30
			}
31
			.medium {
32
				width: 10em;
33
			}
34
			.long {
35
				width: 20em;
36
			}
37
			.verylong {
38
				width: 700px;
39
			}
40
 
41
			.noticeMessage {
42
				color:#093669;
43
				font-size:0.95em;
44
				margin-left:0.5em;
45
			}
46
 
47
			.dojoTitlePaneLabel label {
48
				font-weight:bold;
49
			}
50
		</style>
51
	</head>
52
 
53
	<body>
54
		<h1 class="testTitle">Test DateTextBox Widget</h1>
55
		<!--	to test form submission, you'll need to create an action handler similar to
56
			http://www.utexas.edu/teamweb/cgi-bin/generic.cgi -->
57
		<form id="form1" action="" name="example" method="post">
58
			<div class="dojoTitlePaneLabel">
59
				<label for="q1"> Date (local format) </label>
60
				<span class="noticeMessage">DateTextBox class, no attributes</span>
61
			</div>
62
			<div class="testExample">
63
				<input id="q1" name="noDOMvalue" type="text" dojoType="dijit.form.DateTextBox">
64
			</div>
65
			<div class="dojoTitlePaneLabel">
66
				<label for="q2"> Date (local format - long) </label>
67
				<span class="noticeMessage">DateTextBox class,
68
					Attributes: required="true", trim="true", constraints={min:'2004-01-01',max:'2006-12-31',formatLength:'long'}. Works for leap years</span>
69
			</div>
70
			<div class="testExample">
71
				<input id="q2" type="text" name="date1" class="medium" value="2005-12-30"
72
					dojoType="dijit.form.DateTextBox"
73
					constraints="{min:'2004-01-01',max:'2006-12-31',formatLength:'long'}"
74
					required="true"
75
					trim="true"
76
					promptMessage="mm/dd/yyyy"
77
         				onChange="dojo.byId('oc2').value=arguments[0]"
78
					invalidMessage="Invalid date. Use mm/dd/yyyy format." />
79
 				onChange:<input id="oc2" size="34" disabled value="not fired yet!" autocomplete="off">
80
				<input type="button" value="Destroy" onClick="dijit.byId('q2').destroy(); return false;">
81
			</div>
82
			<div class="dojoTitlePaneLabel">
83
				<label for="q3"> Date (American format) </label>
84
				<span class="noticeMessage">DateTextBox class,
85
					Attributes: lang="en-us", required="true", constraints={min:'2004-01-01',max:'2006-12-31'}. Works for leap years</span>
86
			</div>
87
			<div class="testExample">
88
				<input id="q3" type="text" name="date2" class="medium" value="2005-12-30"
89
					dojoType="dijit.form.DateTextBox"
90
					constraints="{min:'2004-01-01',max:'2006-12-31'}"
91
					lang="en-us"
92
					required="true"
93
					promptMessage="mm/dd/yyyy"
94
					invalidMessage="Invalid date. Use mm/dd/yyyy format." />
95
			</div>
96
			<div class="dojoTitlePaneLabel">
97
				<label for="q4"> Date (German format) </label>
98
				<span class="noticeMessage">DateTextBox class,
99
					Attributes: lang="de-de", constraints={min:2004-01-01, max:2006-12-31}. Works for leap years</span>
100
			</div>
101
			<div class="testExample">
102
				<input id="q4" class="medium"/>
103
			</div>
104
 
105
			<script>
106
			// See if we can make a widget in script and attach it to the DOM ourselves.
107
			dojo.addOnLoad(function(){
108
				var props = {
109
					name: "date4",
110
					value: new Date(2006,10,29),
111
					constraints: {min:new Date(2004,0,1),max:new Date(2006,11,31)},
112
					lang: "de-de",
113
					promptMessage: "dd.mm.yy",
114
					rangeMessage: "Enter a date in 2006.",
115
					invalidMessage: "Invalid date. Use dd.mm.yy format."
116
				};
117
				var w = new dijit.form.DateTextBox(props, "q4");
118
			});
119
			</script>
120
 
121
			<script>
122
				function displayData() {
123
					var f = document.getElementById("form1");
124
					var s = "";
125
					for (var i = 0; i < f.elements.length; i++) {
126
						var elem = f.elements[i];
127
						if (elem.name == "button")  { continue; }
128
						s += elem.name + ": " + elem.value + "\n";
129
					}
130
					alert(s);
131
				}
132
			</script>
133
 
134
			<div>
135
				<button name="button" onclick="displayData(); return false;">view data</button>
136
				<input type="submit" name="submit" />
137
			</div>
138
		</form>
139
	</body>
140
</html>