MisterIsaak
MisterIsaak

Reputation: 3922

Dojo date constraint to a single day per month

Is it possible to make a constraint to only allow the first day of each much a valid option? I'd like to grey out all other dates but I can't seem to find out how to do this? I'm trying to find something useful in Dojo's so called documentation but no luck so far. I understand sending a date to the min and max but that doesn't really solve my issue.

http://dojotoolkit.org/reference-guide/1.7/dijit/form/DateTextBox.html

This is what I've been playing with:

dojo.require("dijit.form.DateTextBox");
<link href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.3/dojo/resources/dojo.css" rel="stylesheet" />
<link href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.3/dijit/themes/claro/claro.css" rel="stylesheet" />
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.9.3/dojo/dojo.js" djConfig="parseOnLoad:true"></script>

<body class="claro">
  <div name="BeginDate" type="text" data-dojo-type="dijit.form.DateTextBox" constraints="{selector:'date',min:'2012'}" datePattern="dd/MMM/yy" value="@Model.BeginDate">
    <script type="dojo/connect" args="newValue" data-dojo-event="onChange">
    </script>
  </div>

Upvotes: 2

Views: 867

Answers (1)

Craig Swing
Craig Swing

Reputation: 8162

Can the user simply select the month and not worry about the day? If so there is a dojox.form.MonthTextBox located in dojox/form/DateTextBox.js.

Upvotes: 3

Related Questions