Cannot get a reference to a dijit form when the form has a DateTextBox
I am having trouble getting a reference to the dijit form widget when the
form contains a DateTextBox. The code snippet below demonstrates the
problem. When executed, the alert box says "undefined". However, if I get
rid of <input ... id="dateTextBox"... />, I am able to get a reference to
the form widget.
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css"
href="//ajax.googleapis.com/ajax/libs/dojo/1.9.1/dijit/themes/claro/claro.css"
media="screen">
<!-- load dojo and provide config via data attribute -->
<script type="text/javascript"
src="//ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojo/dojo.js"
data-dojo-config="async: true, parseOnLoad: true">
</script>
<script type="text/javascript">
require(["dijit/form/TextBox", "dijit/form/DateTextBox"]);
</script>
<script type="text/javascript">
require(["dojo/parser", "dijit/registry", "dijit/form/Form",
"dojo/domReady!"],
function(parser, registry) {
parser.parse();
alert(registry.byId("frm_test"));
});
</script>
</head>
<body class="claro">
<div data-dojo-type="dijit/form/Form" id="frm_test"
encType="multipart/form-data" action="" method="">
<input type="text" id="textBox" name="textBox"
data-dojo-type="dijit/form/TextBox" />
<input type="text" id="dateTextBox" name="dateTextBox"
data-dojo-type="dijit/form/DateTextBox" />
</div>
</body>
</html>
No comments:
Post a Comment