Note that there are some explanatory texts on larger screens.

plurals
  1. POdojo dijit.form.DateTextBox constraints not working, datetextbox
    primarykey
    data
    text
    <p>Hi I'm new to javascript and dojo. I'm trying to use two dijit DateTextBoxes with the drop-down calendars to establish a date range for a query on a database. I want to restrict the dates available, once the begin or end date has been selected, so that its impossible to pick an end date that is chronologically before the begin date, and vice versa. I'm trying to apply the example called 'changing constraints on the fly' (about half way down the page) from the dojo reference here: <a href="http://dojotoolkit.org/reference-guide/dijit/form/DateTextBox.html" rel="nofollow">http://dojotoolkit.org/reference-guide/dijit/form/DateTextBox.html</a> However, the constraints aren't working in my code. The only thing I'm really doing differently is using the<code>tundra</code> theme. Any suggestions would be greatly appreciated. </p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/resources/dojo.css"&gt; &lt;link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dijit/themes/tundra/tundra.css" media="screen" /&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js" data-dojo-config="isDebug: true, parseOnLoad: true"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; dojo.require("dijit.form.DateTextBox"); &lt;/script&gt; &lt;/head&gt; &lt;body class="tundra"&gt; &lt;div&gt; &lt;label for="fromDate"&gt;From:&lt;/label&gt; &lt;input id="fromDate" type="text" name="fromDate" data-dojo-type="dijit.form.DateTextBox" required="true" onChange="dijit.byId('toDate').constraints.min = arguments[0];" /&gt; &lt;label for="toDate"&gt;To:&lt;/label&gt; &lt;input id="toDate" type="text" name="toDate" data-dojo-type="dijit.form.DateTextBox" required="true" onChange="dijit.byId('fromDate').constraints.max = arguments[0];" /&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload