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 TimeTextBox Widget</title>
|
|
|
6 |
|
|
|
7 |
<script type="text/javascript" src="../../../dojo/dojo.js"
|
|
|
8 |
djConfig="isDebug: true, parseOnLoad: true, extraLocale: ['de-de', 'en-us']"></script>
|
|
|
9 |
<script type="text/javascript" src="../_testCommon.js"></script>
|
|
|
10 |
|
|
|
11 |
<script type="text/javascript">
|
|
|
12 |
dojo.require("dijit.form.TextBox");
|
|
|
13 |
dojo.require("dijit.form.ValidationTextBox");
|
|
|
14 |
dojo.require("dijit.form.NumberTextBox");
|
|
|
15 |
dojo.require("dijit.form.CurrencyTextBox");
|
|
|
16 |
dojo.require("dijit.form.DateTextBox");
|
|
|
17 |
dojo.require("dijit.form.TimeTextBox");
|
|
|
18 |
dojo.require("dojo.currency");
|
|
|
19 |
dojo.require("dojo.date.locale");
|
|
|
20 |
dojo.require("dojo.parser"); // scan page for widgets and instantiate them
|
|
|
21 |
</script>
|
|
|
22 |
<style type="text/css">
|
|
|
23 |
@import "../../../dojo/resources/dojo.css";
|
|
|
24 |
@import "../css/dijitTests.css";
|
|
|
25 |
|
|
|
26 |
.testExample {
|
|
|
27 |
background-color:#fbfbfb;
|
|
|
28 |
padding:1em;
|
|
|
29 |
margin-bottom:1em;
|
|
|
30 |
border:1px solid #bfbfbf;
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
.small {
|
|
|
34 |
width: 3em;
|
|
|
35 |
}
|
|
|
36 |
.medium {
|
|
|
37 |
width: 10em;
|
|
|
38 |
}
|
|
|
39 |
.long {
|
|
|
40 |
width: 20em;
|
|
|
41 |
}
|
|
|
42 |
.verylong {
|
|
|
43 |
width: 700px;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
.noticeMessage {
|
|
|
47 |
color:#093669;
|
|
|
48 |
font-size:0.95em;
|
|
|
49 |
margin-left:0.5em;
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
.dojoTitlePaneLabel label {
|
|
|
53 |
font-weight:bold;
|
|
|
54 |
}
|
|
|
55 |
</style>
|
|
|
56 |
</head>
|
|
|
57 |
|
|
|
58 |
<body>
|
|
|
59 |
<h1 class="testTitle">Test TimeTextBox Widget</h1>
|
|
|
60 |
<!-- to test form submission, you'll need to create an action handler similar to
|
|
|
61 |
http://www.utexas.edu/teamweb/cgi-bin/generic.cgi -->
|
|
|
62 |
<form id="form1" action="" name="example" method="post">
|
|
|
63 |
|
|
|
64 |
<div class="dojoTitlePaneLabel">
|
|
|
65 |
<label for="q1">Time using local conventions with seconds</label>
|
|
|
66 |
<span class="noticeMessage">TimeTextBox class,
|
|
|
67 |
Attributes: {formatLength:'medium'}</span>
|
|
|
68 |
</div>
|
|
|
69 |
<div class="testExample">
|
|
|
70 |
<input id="q1" type="text" name="time1" class="medium" value="T17:45:00"
|
|
|
71 |
dojoType="dijit.form.TimeTextBox"
|
|
|
72 |
constraints="{formatLength:'medium'}"
|
|
|
73 |
required="true"
|
|
|
74 |
onChange="dojo.byId('oc1').value=arguments[0]"
|
|
|
75 |
invalidMessage="Invalid time." />
|
|
|
76 |
onChange:<input id="oc1" size="34" disabled value="not fired yet!" autocomplete="off">
|
|
|
77 |
</div>
|
|
|
78 |
|
|
|
79 |
<div class="dojoTitlePaneLabel">
|
|
|
80 |
<label for="q2">Time using local conventions without seconds, required, no invalid message tooltip</label>
|
|
|
81 |
<span class="noticeMessage">TimeTextBox class,
|
|
|
82 |
Attributes: {formatLength:'short'}</span>
|
|
|
83 |
</div>
|
|
|
84 |
<div class="testExample">
|
|
|
85 |
<input id="q2" type="text" name="time1a" class="medium" value="T17:45:00"
|
|
|
86 |
dojoType="dijit.form.TimeTextBox"
|
|
|
87 |
constraints="{formatLength:'short'}"
|
|
|
88 |
required="true"
|
|
|
89 |
invalidMessage="" />
|
|
|
90 |
</div>
|
|
|
91 |
|
|
|
92 |
<div class="dojoTitlePaneLabel">
|
|
|
93 |
<label for="q3"> 12 Hour Time </label>
|
|
|
94 |
<span class="noticeMessage">TimeTextBox class,
|
|
|
95 |
Attributes: {timePattern:'h:mm:ss a'}</span>
|
|
|
96 |
</div>
|
|
|
97 |
<div class="testExample">
|
|
|
98 |
<input id="q3" type="text" name="time1b" class="medium" value="T17:45:00"
|
|
|
99 |
dojoType="dijit.form.TimeTextBox"
|
|
|
100 |
constraints="{timePattern:'h:mm:ss a'}"
|
|
|
101 |
required="true"
|
|
|
102 |
invalidMessage="Invalid time." />
|
|
|
103 |
</div>
|
|
|
104 |
|
|
|
105 |
<div class="dojoTitlePaneLabel">
|
|
|
106 |
<label for="q4"> 24 Hour Time</label>
|
|
|
107 |
<span class="noticeMessage">TimeTextBox class,
|
|
|
108 |
Attributes: {timePattern:'HH:mm:ss'}</span>
|
|
|
109 |
</div>
|
|
|
110 |
<div class="testExample">
|
|
|
111 |
<input id="q4" type="text" name="time2" class="medium" value="T17:45:00"
|
|
|
112 |
dojoType="dijit.form.TimeTextBox"
|
|
|
113 |
constraints="{timePattern:'HH:mm:ss'}"
|
|
|
114 |
required="true"
|
|
|
115 |
invalidMessage="Invalid time. Use HH:mm:ss where HH is 00 - 23 hours.">
|
|
|
116 |
</div>
|
|
|
117 |
|
|
|
118 |
<script>
|
|
|
119 |
function displayData() {
|
|
|
120 |
var f = document.getElementById("form1");
|
|
|
121 |
var s = "";
|
|
|
122 |
for (var i = 0; i < f.elements.length; i++) {
|
|
|
123 |
var elem = f.elements[i];
|
|
|
124 |
if (elem.name == "button") { continue; }
|
|
|
125 |
s += elem.name + ": " + elem.value + "\n";
|
|
|
126 |
}
|
|
|
127 |
alert(s);
|
|
|
128 |
}
|
|
|
129 |
</script>
|
|
|
130 |
|
|
|
131 |
<div>
|
|
|
132 |
<button name="button" onclick="displayData(); return false;">view data</button>
|
|
|
133 |
<input type="submit" name="submit" />
|
|
|
134 |
</div>
|
|
|
135 |
|
|
|
136 |
</form>
|
|
|
137 |
</body>
|
|
|
138 |
</html>
|