title: XPages DateTextBox - setting constraints
body: <p>I am working with the date text box and had a few questions.  This is with designer 9, so its using dojo 1.8 not that it should make too much difference.</p>
  
  <p>Setting Min / Max dates</p>
  
  <p>I don't see a way to do this in designer.  There isn't anything in xe:djDateTimeConstraints that matches, so is this something I need to do via javascript?
  I have an example below that changes the EndDate control once StartDate is selected, but didn't see a way to set StartDate other then beforeRenderResponse or some such.</p>
  
  <p>Selectable Dates</p>
  
  <p><a href="http://dojotoolkit.org/reference-guide/1.8/dijit/form/DateTextBox.html" rel="nofollow">http://dojotoolkit.org/reference-guide/1.8/dijit/form/DateTextBox.html</a>
  "also validates against developer-provided constraints like min, max, valid days of the week, etc."</p>
  
  <p>Valid days of the week - I'd love to set it to just weekdays that are selectable, but there is no example, and the link does not go to a page with a dayofweek constraint.  What term should I be searching for?  In the example below I have a validator, but I didn't know if the date text box could just have the weekends be unselectable.</p>
  
  <p>Here is my example control - when start date is set, it changes constraints of end date</p>
  
  <pre><code>&lt;xp:label value="Start Date" id="lblStartDate"&gt;&lt;/xp:label&gt;
  &lt;xe:djDateTextBox id="djDateStart"&gt;
      &lt;xe:this.constraints&gt;
          &lt;xe:djDateTimeConstraints datePattern="M/dd/yyyy"&gt;&lt;/xe:djDateTimeConstraints&gt;
      &lt;/xe:this.constraints&gt;
      &lt;xp:eventHandler event="onChange" submit="false"&gt;
          &lt;xe:this.script&gt;&lt;![CDATA[
          var startDateID = "#{id:djDateStart}";
          var endDateID = "#{id:djDateEnd}";
          var hiddenEndDateID = "#{id:hiddenEndDate}";
  
      require(["dojo/date/locale"], function(locale){
          var x = new Date (dojo.byId(startDateID).value);
            // Fails if current date is the weekend or empty
          if(locale.isWeekend(x) || dojo.byId(startDateID).value == "") {
              dojo.style(hiddenEndDateID, "display", "none");
              dojo.byId(endDateID).value = "";
              dojo.byId(startDateID).value = "";
              dijit.byId(startDateID).displayMessage("dates must be weekdays");
          } else {
              // Set display value and constraint for End Date
              dojo.byId(endDateID).value = dojo.byId(startDateID).value;
              dijit.byId(endDateID).constraints.min =  arguments[0];
              dijit.byId(endDateID).constraints.max = dojo.date.add(arguments[0], "week", 3);
  
              // Make End Date and Comment visible. 
              dojo.style(hiddenEndDateID, "display", "inline");
          }
      })
      ]]&gt;&lt;/xe:this.script&gt;
      &lt;/xp:eventHandler&gt;
  &lt;/xe:djDateTextBox&gt;
  </code></pre>