| 1 |
<!DOCTYPE html> |
| 2 |
<html lang="en"> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 |
<title>Test DateTextBox 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 |
</style> |
| 28 |
|
| 29 |
|
| 30 |
<link id="themeStyles" rel="stylesheet" href="../../../dijit/themes/claro/claro.css"/> |
| 31 |
|
| 32 |
|
| 33 |
<script type="text/javascript" src="../../../dojo/dojo.js" |
| 34 |
data-dojo-config="async: true, isDebug: true, parseOnLoad: true, extraLocale: ['de-de', 'en-us']"></script> |
| 35 |
|
| 36 |
|
| 37 |
<script type="text/javascript" src="../_testCommon.js"></script> |
| 38 |
|
| 39 |
<script type="text/javascript"> |
| 40 |
function eventHandler(e){ |
| 41 |
// use this.domNode.getAttribute('widgetId') to show "this" is the widget |
| 42 |
// mouseleave/enter map to mouseout/over in all browsers except IE |
| 43 |
console.log(this.domNode.getAttribute('widgetId') + ' ' + e.type); |
| 44 |
} |
| 45 |
|
| 46 |
require([ |
| 47 |
"doh/runner", |
| 48 |
"dojo/date", |
| 49 |
"dojo/date/locale", |
| 50 |
"dojo/_base/lang", |
| 51 |
"dojo/on", |
| 52 |
"dojo/parser", |
| 53 |
"dijit/registry", |
| 54 |
"dijit/form/DateTextBox", |
| 55 |
"dijit/form/Form", |
| 56 |
"dijit/tests/helpers", |
| 57 |
"dojo/domReady!" |
| 58 |
], function(doh, date, locale, lang, on, parser, registry, DateTextBox){ |
| 59 |
// Add test=true to the URL to run unit tests. |
| 60 |
var test = /mode=test/i.test(window.location.href); |
| 61 |
|
| 62 |
parser.parse(); |
| 63 |
|
| 64 |
// See if we can make a widget in script and attach it to the DOM ourselves. |
| 65 |
on(registry.byId('pattern'), "onMouseEnter", eventHandler); |
| 66 |
on(registry.byId('pattern'), "onMouseLeave", eventHandler); |
| 67 |
on(registry.byId('pattern'), "onKeyDown", eventHandler); |
| 68 |
|
| 69 |
var props = { |
| 70 |
name: "date4", |
| 71 |
value: new Date(2006,10,29), |
| 72 |
constraints: {min:new Date(2004,0,1),max:new Date(2006,11,31)}, |
| 73 |
lang: "de-de", |
| 74 |
hasDownArrow: false, |
| 75 |
onMouseEnter: eventHandler, |
| 76 |
onMouseLeave: eventHandler, |
| 77 |
onKeyDown: eventHandler, |
| 78 |
promptMessage: "dd.mm.yy", |
| 79 |
rangeMessage: "Enter a date in the year range 2004-2006.", |
| 80 |
invalidMessage: "Invalid date. Use dd.mm.yy format." |
| 81 |
}; |
| 82 |
var german = new DateTextBox(props, "german"); |
| 83 |
german.startup(); |
| 84 |
var localLong = registry.byId("localLong"); |
| 85 |
var american = registry.byId("american"); |
| 86 |
|
| 87 |
localLong.parse = function(value,constraints){ |
| 88 |
return this.dateLocaleModule.parse(value, (constraints.formatLength="long") && constraints) || |
| 89 |
this.dateLocaleModule.parse(value, (constraints.formatLength="short") && constraints) || |
| 90 |
(this._isEmpty(value) ? null : undefined); // Date |
| 91 |
}; |
| 92 |
|
| 93 |
if(test){ |
| 94 |
doh.register("constraints", [ |
| 95 |
{ |
| 96 |
name: "initial state", |
| 97 |
timeout: 1000, |
| 98 |
runTest: function(t){ |
| 99 |
var expected = new Date(2005,11,30); |
| 100 |
var actual = localLong.get('value'); |
| 101 |
t.is(0, date.compare(expected, actual), 'expected ' + expected.toDateString() + ' but got ' + actual.toDateString()); |
| 102 |
t.is("", localLong.get('state')); |
| 103 |
} |
| 104 |
}, |
| 105 |
{ |
| 106 |
name: "change value, now invalid", |
| 107 |
timeout: 1000, |
| 108 |
runTest: function(t){ |
| 109 |
var expected = new Date(2007,6,15); |
| 110 |
localLong.set("value", expected); |
| 111 |
var actual = localLong.get('value'); |
| 112 |
t.is(0, date.compare(expected, actual), 'expected ' + expected.toDateString() + ' but got ' + actual.toDateString()); |
| 113 |
t.is("Error", localLong.get('state')); |
| 114 |
} |
| 115 |
}, |
| 116 |
{ |
| 117 |
name: "change max, still invalid", |
| 118 |
timeout: 1000, |
| 119 |
runTest: function(t){ |
| 120 |
localLong.set("constraints", lang.mixin(localLong.get('constraints'), { max: new Date(2007,5,30)})); |
| 121 |
var expected = new Date(2007,6,15); |
| 122 |
var actual = localLong.get('value'); |
| 123 |
t.is(0, date.compare(expected, actual), 'expected ' + expected.toDateString() + ' but got ' + actual.toDateString()); |
| 124 |
t.is("Error", localLong.get('state')); |
| 125 |
} |
| 126 |
}, |
| 127 |
{ |
| 128 |
name: "change max, now valid", |
| 129 |
timeout: 1000, |
| 130 |
runTest: function(t){ |
| 131 |
localLong.set("constraints", lang.mixin(localLong.get('constraints'), { max: new Date(2007,11,31)})); |
| 132 |
var expected = new Date(2007,6,15); |
| 133 |
var actual = localLong.get('value'); |
| 134 |
t.is(0, date.compare(expected, actual), 'expected ' + expected.toDateString() + ' but got ' + actual.toDateString()); |
| 135 |
t.is("", localLong.get('state')); |
| 136 |
} |
| 137 |
}, |
| 138 |
{ |
| 139 |
name: "change max, now invalid", |
| 140 |
timeout: 1000, |
| 141 |
runTest: function(t){ |
| 142 |
localLong.set("constraints", lang.mixin(localLong.get('constraints'), { max: new Date(2006,11,30)})); |
| 143 |
var expected = new Date(2007,6,15); |
| 144 |
var actual = localLong.get('value'); |
| 145 |
t.is(0, date.compare(expected, actual), 'expected ' + expected.toDateString() + ' but got ' + actual.toDateString()); |
| 146 |
t.is("Error", localLong.get('state')); |
| 147 |
} |
| 148 |
}, |
| 149 |
{ |
| 150 |
name: "change value, now valid", |
| 151 |
timeout: 1000, |
| 152 |
runTest: function(t){ |
| 153 |
var expected = new Date(2005,11,30); |
| 154 |
localLong.set("value", expected); |
| 155 |
var actual = localLong.get('value'); |
| 156 |
t.is(0, date.compare(expected, actual), 'expected ' + expected.toDateString() + ' but got ' + actual.toDateString()); |
| 157 |
t.is("", localLong.get('state')); |
| 158 |
} |
| 159 |
} |
| 160 |
]); |
| 161 |
|
| 162 |
doh.register("misc", |
| 163 |
function noYear(){ |
| 164 |
var widget = registry.byId("noyear"); |
| 165 |
doh.t(widget.isValid(false), "isValid"); |
| 166 |
doh.is(2011, widget.get('value').getFullYear(), "programmatic value"); |
| 167 |
doh.is(2011, widget.value.getFullYear(), "JS value"); |
| 168 |
}, |
| 169 |
function noParams(){ |
| 170 |
// Just making sure we don't get an exception when no parameters are specified. |
| 171 |
new DateTextBox(); |
| 172 |
} |
| 173 |
); |
| 174 |
|
| 175 |
doh.register("API", [ |
| 176 |
function initial(){ |
| 177 |
// initial conditions |
| 178 |
doh.is(0, date.compare(new Date(2005,11,30), american.get('value')), 'wire value of american: ' + american.get('value')); |
| 179 |
doh.is('12/30/2005', american.get('displayedValue'), 'displayed value of american'); |
| 180 |
}, |
| 181 |
|
| 182 |
function setValue(){ |
| 183 |
american.set('value', new Date(2004,9,20)); |
| 184 |
doh.is(0, date.compare(new Date(2004,9,20), american.get('value')), |
| 185 |
'wire value of american is: ' + american.get('value') + |
| 186 |
' but should be: ' + new Date(2004,9,20)); |
| 187 |
doh.is('10/20/2004', american.get('displayedValue'), 'displayed value of american'); |
| 188 |
doh.t(american.isValid(), 'marked as valid'); |
| 189 |
}, |
| 190 |
|
| 191 |
function setDisplayedValue(){ |
| 192 |
american.set('displayedValue', '11/12/2006'); |
| 193 |
doh.is(0, date.compare(new Date(2006, 10, 12), american.get('value')), 'wire value of american'); |
| 194 |
doh.is('11/12/2006', american.get('displayedValue'), 'displayed value of american'); |
| 195 |
doh.t(american.isValid(), 'marked as valid'); |
| 196 |
}, |
| 197 |
|
| 198 |
function setInvalidDisplayedValue(){ |
| 199 |
american.set('displayedValue', 'foo'); |
| 200 |
doh.t(american.get('value') === undefined, 'value is undefined if displayedValue is garbage'); |
| 201 |
doh.f(american.isValid(), 'marked as invalid'); |
| 202 |
|
| 203 |
// setting the value to get('value') should never change anything, so |
| 204 |
// therefore setting the value to undefined shouldn't affect the displayed value |
| 205 |
american.set('value', undefined); |
| 206 |
doh.is(american.get('displayedValue'), 'foo'); |
| 207 |
}, |
| 208 |
|
| 209 |
function setOutOfRange(){ |
| 210 |
// This widget is set to be valid between 2004 and 2006 only |
| 211 |
american.set('displayedValue', '12/1/2008'); |
| 212 |
doh.f(american.isValid(), 'marked as invalid since out of range'); |
| 213 |
doh.is('12/1/2008', american.get('displayedValue'), 'displayed value of american'); |
| 214 |
}, |
| 215 |
|
| 216 |
function noInitialValue(){ |
| 217 |
var fromDate = registry.byId('fromDate'); |
| 218 |
doh.is('', fromDate.get('displayedValue'), 'initially blank'); |
| 219 |
doh.is(new Date('').toString(), fromDate.value.toString(), 'default value'); |
| 220 |
var d = new doh.Deferred(); |
| 221 |
var today = new Date(); |
| 222 |
fromDate.set('value', today, true); |
| 223 |
setTimeout(d.getTestCallback(function(){ |
| 224 |
var toDate = registry.byId('toDate'); |
| 225 |
doh.is(today.toDateString(), fromDate.value.toDateString(), 'changed value'); |
| 226 |
doh.is(today.toDateString(), toDate.constraints.min.toDateString(), 'onChange'); |
| 227 |
}), 500); |
| 228 |
return d; |
| 229 |
}, |
| 230 |
|
| 231 |
function ariaRolesAndAttributes(){ |
| 232 |
var d = new doh.Deferred(), |
| 233 |
button = registry.byId("local"); |
| 234 |
|
| 235 |
doh.is("combobox", button._popupStateNode.getAttribute("role"), "button _popupStateNode role"); |
| 236 |
doh.t(button._popupStateNode.getAttribute("aria-haspopup"), "aria-haspopup on button"); |
| 237 |
doh.f(button._popupStateNode.getAttribute("aria-expanded"), "initially missing aria-expanded"); |
| 238 |
doh.f(button._popupStateNode.getAttribute("aria-owns"), "initally missing aria-owns"); |
| 239 |
|
| 240 |
button.openDropDown(); |
| 241 |
|
| 242 |
setTimeout(d.getTestCallback(function(){ |
| 243 |
doh.t(button._popupStateNode.getAttribute("aria-expanded"), "now aria-expanded should be true"); |
| 244 |
doh.is("local_popup", button._popupStateNode.getAttribute("aria-owns"), "should aria-own the Dlg"); |
| 245 |
// Check roles and attributes on the dialog |
| 246 |
var dlg = registry.byId("local_popup"); |
| 247 |
doh.t(dlg.domNode.hasAttribute("role"), "Dlg.domNode should have a role"); |
| 248 |
doh.is("local_popup_mddb local_popup_year", dlg.domNode.getAttribute("aria-labelledby"), "aria-labelledby should not overwrite existing labelledby for the Calendar"); |
| 249 |
|
| 250 |
button.closeDropDown(); |
| 251 |
}), 500); |
| 252 |
|
| 253 |
return d; |
| 254 |
} |
| 255 |
]); |
| 256 |
|
| 257 |
doh.register("localization", [ |
| 258 |
function initialGerman(){ |
| 259 |
doh.is(0, date.compare(new Date(2006,10,29), german.get('value')), 'wire value of german: ' + german.get('value')); |
| 260 |
doh.is('29.11.2006', german.get('displayedValue'), 'displayed value of german'); |
| 261 |
}, |
| 262 |
|
| 263 |
function setValueGerman(){ |
| 264 |
german.set('value', new Date(2004,9,20)); |
| 265 |
doh.is(0, date.compare(new Date(2004,9,20), german.get('value')), |
| 266 |
'wire value of german is: ' + german.get('value') + |
| 267 |
' but should be: ' + new Date(2004,9,20)); |
| 268 |
doh.is('20.10.2004', german.get('displayedValue'), 'displayed value of german'); |
| 269 |
doh.t(german.isValid(), 'marked as valid'); |
| 270 |
}, |
| 271 |
|
| 272 |
function setDisplayedValueGerman(){ |
| 273 |
german.set('displayedValue', '12.11.2006'); |
| 274 |
doh.is(0, date.compare(new Date(2006, 10, 12), german.get('value')), 'wire value of german'); |
| 275 |
doh.is('12.11.2006', german.get('displayedValue'), 'displayed value of german'); |
| 276 |
doh.t(german.isValid(), 'marked as valid'); |
| 277 |
}, |
| 278 |
{ |
| 279 |
name: "labels", |
| 280 |
timeout: 6000, |
| 281 |
runTest: function(){ |
| 282 |
german.set('value', new Date(2006, 9, 15)); // 10/15/2006 |
| 283 |
|
| 284 |
german.openDropDown(); |
| 285 |
var calendar = registry.byId("german_popup"); |
| 286 |
|
| 287 |
// calendar exists and is shown |
| 288 |
doh.t(calendar && isVisible(calendar), "calendar is visible"); |
| 289 |
|
| 290 |
// Month label |
| 291 |
doh.is("Oktober", innerText(query(".dijitCalendarCurrentMonthLabel", calendar.domNode)[0])); |
| 292 |
|
| 293 |
// Day labels |
| 294 |
var dayLabels = query(".dijitCalendarDayLabelTemplate", calendar.domNode); |
| 295 |
doh.is(7, dayLabels.length, "7 day labels"); |
| 296 |
doh.is("M", innerText(dayLabels[0]), "day 0"); |
| 297 |
doh.is("D", innerText(dayLabels[1]), "day 1"); |
| 298 |
doh.is("M", innerText(dayLabels[2]), "day 2"); |
| 299 |
doh.is("D", innerText(dayLabels[3]), "day 3"); |
| 300 |
doh.is("F", innerText(dayLabels[4]), "day 4"); |
| 301 |
doh.is("S", innerText(dayLabels[5]), "day 5"); |
| 302 |
doh.is("S", innerText(dayLabels[6]), "day 6"); |
| 303 |
german.closeDropDown(); |
| 304 |
} |
| 305 |
} |
| 306 |
]); |
| 307 |
|
| 308 |
doh.run(); |
| 309 |
} |
| 310 |
}); |
| 311 |
</script> |
| 312 |
</head> |
| 313 |
|
| 314 |
<body class="claro" role="main"> |
| 315 |
|
| 316 |
<script type="dojo/require"> |
| 317 |
dom: "dojo/dom", |
| 318 |
query: "dojo/query", |
| 319 |
registry: "dijit/registry" |
| 320 |
</script> |
| 321 |
|
| 322 |
<h1 class="testTitle">Test DateTextBox Widget</h1> |
| 323 |
|
| 324 |
|
| 325 |
<form id="form1" data-dojo-type='dijit/form/Form' data-dojo-props='action:"", name:"example", method:"", onSubmit:function(){ return this.validate() }'> |
| 326 |
<div class="dojoTitlePaneLabel"> |
| 327 |
<label for="local"> Date (local format) </label> |
| 328 |
<span class="noticeMessage">DateTextBox class, no attributes</span> |
| 329 |
</div> |
| 330 |
<div class="testExample"> |
| 331 |
<input id="local" data-dojo-type="dijit/form/DateTextBox" style="width: 100px" |
| 332 |
data-dojo-props='name:"noDOMvalue", value:"2008-12-31", type:"text", onMouseEnter:eventHandler, |
| 333 |
onMouseLeave:eventHandler, |
| 334 |
onKeyDown:eventHandler, |
| 335 |
onChange:function(val){ dom.byId("oc1").value = "" + val; } |
| 336 |
'/> |
| 337 |
<label for="oc1">onChange:</label><input id="oc1" size="34" disabled value="not fired yet!" autocomplete="off"/> |
| 338 |
<span style='white-space:nowrap;'> |
| 339 |
<button type="button" onclick="registry.byId('local').set('value', null);">set('value',null)</button> |
| 340 |
<button type="button" onclick="dom.byId('gv1').value=''+registry.byId('local').get('value');">get('value')</button> |
| 341 |
<button type="button" onclick="dom.byId('gv1').value=''+registry.byId('local').value;">.value</button> |
| 342 |
<label for="gv1">l:</label><input id="gv1" size="34" disabled value="not called yet!" autocomplete="off"/> |
| 343 |
</span> |
| 344 |
</div> |
| 345 |
<div class="dojoTitlePaneLabel"> |
| 346 |
<label for="localLong"> Date (local format - long) </label> |
| 347 |
<span class="noticeMessage">DateTextBox class, |
| 348 |
Attributes: required="true", trim="true", constraints={min:'2004-01-01',max:'2006-12-31',formatLength:'long'}. Works for leap years</span> |
| 349 |
</div> |
| 350 |
<div class="testExample"> |
| 351 |
<input id="localLong" data-dojo-id="localLong" data-dojo-type="dijit/form/DateTextBox" |
| 352 |
data-dojo-props='type:"text", name:"date1", value:"2005-12-30", |
| 353 |
constraints:{min:"2004-01-01",max:"2006-12-31",formatLength:"long"}, |
| 354 |
required:true, |
| 355 |
trim:true, |
| 356 |
onChange:function(val){ dom.byId("oc2").value = val; }, |
| 357 |
onMouseEnter:eventHandler, |
| 358 |
onMouseLeave:eventHandler, |
| 359 |
onKeyDown:eventHandler, |
| 360 |
invalidMessage:"Invalid date." '/> |
| 361 |
<label for="oc2">onChange:</label><input id="oc2" size="34" disabled value="not fired yet!" autocomplete="off"/> |
| 362 |
<input type="button" value="Destroy" onClick="registry.byId('localLong').destroy(); return false;"/> |
| 363 |
<input type="button" value="set max to 2007-12-31" onClick="registry.byId('localLong').constraints.max = new Date(2007,11,31); registry.byId('localLong').validate(false); return false;"/> |
| 364 |
</div> |
| 365 |
<div class="dojoTitlePaneLabel"> |
| 366 |
<label for="american"> Date (American format) </label> |
| 367 |
<span class="noticeMessage">DateTextBox class, |
| 368 |
Attributes: lang="en-us", required="true", constraints={min:'2004-01-01',max:'2006-12-31'}. Works for leap years. |
| 369 |
Prompt message whenever field is blank. |
| 370 |
</span> |
| 371 |
</div> |
| 372 |
<div class="testExample"> |
| 373 |
<input id="american" data-dojo-type="dijit/form/DateTextBox" |
| 374 |
data-dojo-props='type:"text", name:"date2", value:"2005-12-30", |
| 375 |
constraints:{min:"2004-01-01",max:"2006-12-31"}, |
| 376 |
lang:"en-us", |
| 377 |
required:true, |
| 378 |
onMouseEnter:eventHandler, |
| 379 |
onMouseLeave:eventHandler, |
| 380 |
onKeyDown:eventHandler, |
| 381 |
promptMessage:"mm/dd/yyyy", |
| 382 |
invalidMessage:"Invalid date. Use mm/dd/yyyy format."'/> |
| 383 |
</div> |
| 384 |
<div class="dojoTitlePaneLabel"> |
| 385 |
<label for="german"> Date (German format)</label> |
| 386 |
<span class="noticeMessage">DateTextBox class, |
| 387 |
Attributes: lang="de-de", hasDownArrow=false, constraints={min:2004-01-01, max:2006-12-31}. Works for leap years. |
| 388 |
Prompt message whenever field is blank. |
| 389 |
</span> |
| 390 |
</div> |
| 391 |
<div class="testExample"> |
| 392 |
<input id="german"/> |
| 393 |
</div> |
| 394 |
|
| 395 |
<div class="dojoTitlePaneLabel"> |
| 396 |
<label for="pattern"> Date, overriding pattern</label> |
| 397 |
<span class="noticeMessage">Date, overriding pattern with dd-MM-yyyy</span> |
| 398 |
</div> |
| 399 |
<div class="testExample"> |
| 400 |
<input id="pattern" data-dojo-type="dijit/form/DateTextBox" data-dojo-props='name:"noDOMvalue", type:"text", constraints:{datePattern:"dd-MM-yyyy", strict:true}'/> |
| 401 |
</div> |
| 402 |
<div class="dojoTitlePaneLabel"> |
| 403 |
<strong>Using title attribute for label</strong> |
| 404 |
<span class="noticeMessage">DateTextBox class, |
| 405 |
Attributes: lang="en-us", required="true", prompt message, invalid message |
| 406 |
Prompt message whenever field is blank. |
| 407 |
</span> |
| 408 |
</div> |
| 409 |
<div class="testExample"> |
| 410 |
<div id="american2" data-dojo-type="dijit/form/DateTextBox" |
| 411 |
data-dojo-props='type:"text", name:"date20", value:"2008-12-30", |
| 412 |
title:"Date in month, day, year format", |
| 413 |
lang:"en-us", |
| 414 |
required:true, |
| 415 |
promptMessage:"mm/dd/yyyy", |
| 416 |
invalidMessage:"Invalid date. Use mm/dd/yyyy format."'> |
| 417 |
</div> |
| 418 |
</div> |
| 419 |
|
| 420 |
<script> |
| 421 |
function displayData(){ |
| 422 |
var f = document.getElementById("form1"); |
| 423 |
var s = ""; |
| 424 |
for(var i = 0; i < f.elements.length; i++){ |
| 425 |
var elem = f.elements[i]; |
| 426 |
if(elem.name == "button") { continue; } |
| 427 |
s += elem.name + ": " + elem.value + "\n"; |
| 428 |
} |
| 429 |
alert(s); |
| 430 |
} |
| 431 |
</script> |
| 432 |
|
| 433 |
<div class="dojoTitlePaneLabel"> |
| 434 |
Date pairs, from/to (won't submit unless from/to fields filled in correctly): |
| 435 |
</div> |
| 436 |
<div class="testExample"> |
| 437 |
<label for="fromDate">From:</label> <input id="fromDate" data-dojo-type="dijit/form/DateTextBox" |
| 438 |
data-dojo-props='type:"text", name:"fromDate", required:true, |
| 439 |
onChange:function(){ registry.byId("toDate").constraints.min = this.get("value"); } '/> |
| 440 |
<label for="toDate">To:</label> <input id="toDate" data-dojo-type="dijit/form/DateTextBox" |
| 441 |
data-dojo-props='type:"text", name:"toDate", required:true, |
| 442 |
onChange:function(){ registry.byId("fromDate").constraints.max = this.get("value"); } '/> |
| 443 |
|
| 444 |
</div> |
| 445 |
|
| 446 |
<div class="dojoTitlePaneLabel"> |
| 447 |
<label for="noyear">Pick a day in 3Q 2011</label> |
| 448 |
</div> |
| 449 |
<div class="testExample"> |
| 450 |
<input data-dojo-type="dijit/form/DateTextBox" id="noyear" data-dojo-props=' |
| 451 |
name:"noyear", |
| 452 |
required:"true", |
| 453 |
constraints:{datePattern:"MMMM dd", |
| 454 |
min:new Date(2011,9,1), |
| 455 |
max:new Date(2011,11,31) |
| 456 |
}, |
| 457 |
parse:function(){ |
| 458 |
var d = this.inherited("parse", arguments); |
| 459 |
if(d instanceof Date)d.setFullYear(2011); |
| 460 |
return d; |
| 461 |
}, |
| 462 |
value:new Date(2011,10,25)' |
| 463 |
/> |
| 464 |
</div> |
| 465 |
|
| 466 |
<button type="button" name="button" onclick="displayData(); return false;">view data</button> |
| 467 |
<input type="submit" name="submit" /> |
| 468 |
<input type="reset" name="reset" /> |
| 469 |
</form> |
| 470 |
</body> |
| 471 |
</html> |