| 1 |
<!DOCTYPE html> |
| 2 |
<html lang="en"> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 |
<title>Test TimeTextBox Widget</title> |
| 6 |
|
| 7 |
<style type="text/css"> |
| 8 |
@import "../../themes/claro/document.css"; |
| 9 |
@import "../css/dijitTests.css"; |
| 10 |
|
| 11 |
.testExample { |
| 12 |
background-color:#fbfbfb; |
| 13 |
padding:1em; |
| 14 |
margin-bottom:1em; |
| 15 |
border:1px solid #bfbfbf; |
| 16 |
} |
| 17 |
|
| 18 |
.noticeMessage { |
| 19 |
color:#093669; |
| 20 |
font-size:0.95em; |
| 21 |
margin-left:0.5em; |
| 22 |
} |
| 23 |
|
| 24 |
.dojoTitlePaneLabel label { |
| 25 |
font-weight:bold; |
| 26 |
} |
| 27 |
|
| 28 |
.dijitDownArrowActive, |
| 29 |
.dijitUpArrowActive { |
| 30 |
opacity:0.5 !important; /* just to test effect of clicking the up or down arrows */ |
| 31 |
} |
| 32 |
</style> |
| 33 |
|
| 34 |
|
| 35 |
<link id="themeStyles" rel="stylesheet" href="../../../dijit/themes/claro/claro.css"/> |
| 36 |
|
| 37 |
|
| 38 |
<script type="text/javascript" src="../../../dojo/dojo.js" |
| 39 |
data-dojo-config="isDebug: true, parseOnLoad: true"></script> |
| 40 |
|
| 41 |
|
| 42 |
<script type="text/javascript" src="../_testCommon.js"></script> |
| 43 |
|
| 44 |
<script type="text/javascript"> |
| 45 |
dojo.require("dijit.form.TimeTextBox"); |
| 46 |
dojo.require("dojo.parser"); // scan page for widgets and instantiate them |
| 47 |
|
| 48 |
formValue = null; |
| 49 |
|
| 50 |
function displayData(){ |
| 51 |
var f = document.getElementById("form1"); |
| 52 |
var s = ""; |
| 53 |
for(var i = 0; i < f.elements.length; i++){ |
| 54 |
var elem = f.elements[i]; |
| 55 |
if(elem.name == "button") { continue; } |
| 56 |
s += elem.name + ": " + elem.value + "\n"; |
| 57 |
} |
| 58 |
console.log(s); |
| 59 |
formValue = s; |
| 60 |
} |
| 61 |
</script> |
| 62 |
</head> |
| 63 |
|
| 64 |
<body class="claro" role="main"> |
| 65 |
<h1 class="testTitle">Test TimeTextBox Widget</h1> |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
<form id="form1" action="" name="example" method="GET" onsubmit="displayData(); return false;"> |
| 72 |
|
| 73 |
<div> |
| 74 |
<input type="submit" name="submit" value="fake submit"/> |
| 75 |
</div> |
| 76 |
<br/> |
| 77 |
|
| 78 |
<div class="dojoTitlePaneLabel"> |
| 79 |
<label for="q1">Time using local conventions with seconds</label> |
| 80 |
<span class="noticeMessage">TimeTextBox class, |
| 81 |
Attributes: {formatLength:'medium'}</span> |
| 82 |
</div> |
| 83 |
<div class="testExample"> |
| 84 |
<input id="q1" data-dojo-type="dijit/form/TimeTextBox" |
| 85 |
data-dojo-props='type:"text", name:"time1", value:"T17:45:00", |
| 86 |
constraints:{formatLength:"medium"}, |
| 87 |
required:true, |
| 88 |
onChange:function(val){ dojo.byId("oc1").value = val; }, |
| 89 |
invalidMessage:"Invalid time." '/> |
| 90 |
<label for="oc1">onChange:</label><input id="oc1" size="34" disabled value="not fired yet!" autocomplete="off"/> |
| 91 |
</div> |
| 92 |
|
| 93 |
<div class="dojoTitlePaneLabel"> |
| 94 |
<label for="q2">Time using local conventions without seconds, required, no invalid message tooltip</label> |
| 95 |
<span class="noticeMessage">TimeTextBox class, |
| 96 |
Attributes: {formatLength:'short'}</span> |
| 97 |
</div> |
| 98 |
<div class="testExample"> |
| 99 |
<input id="q2" data-dojo-type="dijit/form/TimeTextBox" |
| 100 |
data-dojo-props='type:"text", name:"time1a", value:"T17:45:00", |
| 101 |
constraints:{formatLength:"short"}, |
| 102 |
required:true, |
| 103 |
invalidMessage:"" '/> |
| 104 |
</div> |
| 105 |
|
| 106 |
<div class="dojoTitlePaneLabel"> |
| 107 |
<label for="q3"> 12 Hour Time </label> |
| 108 |
<span class="noticeMessage">TimeTextBox class, |
| 109 |
Attributes: {timePattern:'h:mm:ss a'}</span> |
| 110 |
</div> |
| 111 |
<div class="testExample"> |
| 112 |
<input id="q3" data-dojo-type="dijit/form/TimeTextBox" |
| 113 |
data-dojo-props='type:"text", name:"time1b", value:"T17:45:00", |
| 114 |
constraints:{timePattern:"h:mm:ss a"}, |
| 115 |
required:true, |
| 116 |
invalidMessage:"Invalid time." '/> |
| 117 |
</div> |
| 118 |
|
| 119 |
<div class="dojoTitlePaneLabel"> |
| 120 |
<label for="q4"> 24 Hour Time</label> |
| 121 |
<span class="noticeMessage">TimeTextBox class, |
| 122 |
Attributes: {timePattern:'HH:mm:ss'}</span> |
| 123 |
</div> |
| 124 |
<div class="testExample"> |
| 125 |
<input id="q4" data-dojo-type="dijit/form/TimeTextBox" |
| 126 |
data-dojo-props='type:"text", name:"time2", value:"T17:45:00", |
| 127 |
constraints:{timePattern:"HH:mm:ss"}, |
| 128 |
required:true, |
| 129 |
invalidMessage:"Invalid time. Use HH:mm:ss where HH is 00 - 23 hours."'/> |
| 130 |
</div> |
| 131 |
|
| 132 |
<div class="dojoTitlePaneLabel"> |
| 133 |
<label for="q6">Initially empty time text box</label> |
| 134 |
<span class="noticeMessage">TimeTextBox class, |
| 135 |
Attributes: {formatLength:'medium',min:'T00:00:00',max:'T12:00:00'}</span> |
| 136 |
</div> |
| 137 |
<div class="testExample"> |
| 138 |
<input id="q6" data-dojo-type="dijit/form/TimeTextBox" |
| 139 |
data-dojo-props='type:"text", name:"time6", |
| 140 |
constraints:{formatLength:"medium",min:"T00:00:00",max:"T12:00:00"}, |
| 141 |
required:true, |
| 142 |
onChange:function(val){ dojo.byId("oc6").value = val; }, |
| 143 |
invalidMessage:"Invalid time." '/> |
| 144 |
<label for="oc6">onChange:</label><input id="oc6" size="34" disabled value="not fired yet!" autocomplete="off"/> |
| 145 |
</div> |
| 146 |
<div class="dojoTitlePaneLabel"> |
| 147 |
<strong>Using title attribute for label.</strong> |
| 148 |
<span class="noticeMessage">TimeTextBox class, |
| 149 |
Attributes: {formatLength:'short'} Time using local conventions without seconds, required, no invalid message tooltip</span> |
| 150 |
</div> |
| 151 |
<div class="testExample"> |
| 152 |
<input id="q20" data-dojo-type="dijit/form/TimeTextBox" |
| 153 |
data-dojo-props='type:"text", name:"q20", value:"T17:45:00", |
| 154 |
title:"title: Time using local conventions", |
| 155 |
constraints:{formatLength:"short"}, |
| 156 |
required:true, |
| 157 |
invalidMessage:"" '/> |
| 158 |
</div> |
| 159 |
<div class="dojoTitlePaneLabel"> |
| 160 |
<strong>Ticket #18201</strong> |
| 161 |
<span class="noticeMessage">Ensure that Date values can used with TimeTextBoxes</span> |
| 162 |
</div> |
| 163 |
<div class="testExample"> |
| 164 |
<input id="q21"/> |
| 165 |
<script type="text/javascript"> |
| 166 |
require(["dijit/form/TimeTextBox", "dojo/domReady!"], function(TimeTextBox){ |
| 167 |
new TimeTextBox({name: "q21", value: new Date(), |
| 168 |
constraints: { |
| 169 |
timePattern: 'HH:mm a', |
| 170 |
clickableIncrement: 'T00:15:00', |
| 171 |
visibleIncrement: 'T00:15:00', |
| 172 |
visibleRange: 'T01:00:00' |
| 173 |
} |
| 174 |
}, "q21").startup(); |
| 175 |
}); |
| 176 |
</script> |
| 177 |
</div> |
| 178 |
<div class="dojoTitlePaneLabel"> |
| 179 |
<label for="q22">TimeTextBox with dropdown from 9AM - 5PM</label> |
| 180 |
<span class="noticeMessage">TimeTextBox class, |
| 181 |
Attributes: {formatLength:"medium", |
| 182 |
pickerMin: "T09:00:00", |
| 183 |
clickableIncrement: "T01:00:00", |
| 184 |
pickerMax: "T17:00:00"}</span> |
| 185 |
</div> |
| 186 |
<div class="testExample"> |
| 187 |
<input id="q22" data-dojo-type="dijit/form/TimeTextBox" |
| 188 |
data-dojo-props=' |
| 189 |
type:"text", |
| 190 |
name:"time22", |
| 191 |
value:"T9:45:00", |
| 192 |
constraints:{ |
| 193 |
formatLength:"medium", |
| 194 |
pickerMin: "T09:00:00", |
| 195 |
clickableIncrement: "T01:00:00", |
| 196 |
pickerMax: "T17:00:00" |
| 197 |
}, |
| 198 |
required:true, |
| 199 |
onChange:function(val){ dojo.byId("oc22").value = val; }, |
| 200 |
invalidMessage:"Invalid time." '/> |
| 201 |
<label for="oc22">onChange:</label><input id="oc22" size="34" disabled value="not fired yet!" autocomplete="off"/> |
| 202 |
</div> |
| 203 |
</form> |
| 204 |
<input id="ro" type="button" onclick="dijit.byId('q20').set('readOnly',true);" value="Set readOnly" tabIndex="-1"/> |
| 205 |
<input id="rw" type="button" onclick="dijit.byId('q20').set('readOnly',false);" value="Clear readOnly" tabIndex="-1"/> |
| 206 |
<input id="disable" type="button" onclick="dijit.byId('q20').set('disabled',true);" value="Disable" tabIndex="-1"/> |
| 207 |
<input id="enable" type="button" onclick="dijit.byId('q20').set('disabled',false);" value="Enable" tabIndex="-1"/> |
| 208 |
</body> |
| 209 |
</html> |