title: How do I make my dropdowns (form:select) required with Spring and Dojo?
body: <p>How do I make my dropdowns (form:select) required with Spring and Dojo?.  I am working on a Spring project with Dojo to make my pages look nice.  I have the input fields working but now one of my pages has a dropdown on it.  How can I make the dropdown like the my dojo inputs and how do I make it required.  please see code below...</p>
  
  <pre><code>&lt;%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%&gt;
  &lt;%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"%&gt;
  &lt;%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%&gt;
  
  
  &lt;script type="text/javascript"
      src="&lt;c:url value="/resources/dojo/dojo.js" /&gt;"&gt;
  
  &lt;/script&gt;
  &lt;script type="text/javascript"
      src="&lt;c:url value="/resources/spring/Spring.js" /&gt;"&gt;
  
  &lt;/script&gt;
  &lt;script type="text/javascript"
      src="&lt;c:url value="/resources/spring/Spring-Dojo.js" /&gt;"&gt;
  
  &lt;/script&gt;
  
  &lt;link type="text/css" rel="stylesheet"
      href="&lt;c:url value="/resources/dijit/themes/claro/claro.css" /&gt;" /&gt;
  
  
  &lt;script type="dojo/method" data-dojo-event="onSubmit"&gt;
          if(this.validate()){
              return confirm('Form is valid, press OK to submit');
          }else{
              alert('Form contains invalid data.  Please correct first');
              return false;
          }
          return true;
      &lt;/script&gt;
  
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Spring 3.0 MVC - Web Flow Example&lt;/title&gt;
  &lt;/head&gt;
  &lt;body class="claro"&gt;
      &lt;h2&gt;Customer Registration&lt;/h2&gt;
  
      &lt;form:form commandName="customer"&gt;
          &lt;input type="hidden" name="_flowExecutionKey"
              value="${flowExecutionKey}" /&gt;
          &lt;div id="container"&gt;
              &lt;table&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;b&gt;Active&lt;/n&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;form:radiobutton tabIndex="1" value="A" path="type"
                              id="A" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;b&gt;Retired&lt;/b&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;form:radiobutton tabIndex="2" value="R" path="type"
                              id="R" /&gt; &lt;script type="text/javascript"&gt;
                                  Spring
                                          .addDecoration(new Spring.ElementDecoration(
                                                  {
                                                      elementId : 'A',
                                                      widgetType : "dijit.form.RadioButton",
                                                      widgetAttrs : {
                                                          value : "A",
                                                          required : true
                                                      }
                                                  }));
                                  Spring
                                          .addDecoration(new Spring.ElementDecoration(
                                                  {
                                                      elementId : 'R',
                                                      widgetType : "dijit.form.RadioButton",
                                                      widgetAttrs : {
                                                          value : "R",
                                                          required : true
                                                      }
                                                  }));
                              &lt;/script&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;font color=red&gt;&lt;form:errors path="sex" /&gt;&lt;/font&gt;&lt;b&gt;Sex:
                      &lt;/b&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;form:select path="sex"&gt;
                              &lt;option value="MALE"&gt;MALE&lt;/option&gt;
                              &lt;option value="FEMALE"&gt;FEMALE&lt;/option&gt;
                          &lt;/form:select&gt; &lt;script type="text/javascript"&gt;
                              Spring.addDecoration(new Spring.ElementDecoration({
                                  elementId : "name",
                                  widgetType : "dijit.form.ValidationTextBox",
                                  widgetAttrs : {
                                      promptMessage : "Enter Name",
                                      required : true
                                  }
                              }));
                          &lt;/script&gt; &lt;br /&gt;
                          &lt;p&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;font color=red&gt;&lt;form:errors path="name" /&gt;&lt;/font&gt;&lt;b&gt;Name:
                      &lt;/b&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;form:input path="name" class="value" /&gt; &lt;script
                              type="text/javascript"&gt;
                          Spring.addDecoration(new Spring.ElementDecoration({
                              elementId : "name",
                              widgetType : "dijit.form.ValidationTextBox",
                              widgetAttrs : {
                                  promptMessage : "Enter Name",
                                  required : true
                              }
                          }));
                      &lt;/script&gt; &lt;br /&gt;
                          &lt;p&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;font color=red&gt;&lt;form:errors path="phoneNumber" /&gt;&lt;/font&gt;
  
                          &lt;b&gt;Phone number: &lt;/b&gt;&lt;/td&gt;
                      &lt;td&gt;
                          &lt;div class="span-7 last"&gt;
                              &lt;form:input path="phoneNumber" /&gt;
                          &lt;/div&gt; &lt;script type="text/javascript"&gt;
                              Spring
                                      .addDecoration(new Spring.ElementDecoration(
                                              {
                                                  elementId : "phoneNumber",
                                                  widgetType : "dijit.form.ValidationTextBox",
                                                  widgetAttrs : {
                                                      required : true,
                                                      invalidMessage : "A 16-digit credit card number is required.",
                                                      regExp : "[0-9]{16}"
                                                  }
                                              }));
                          &lt;/script&gt; &lt;br /&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;font color=red&gt;&lt;form:errors path="address" /&gt;&lt;/font&gt; &lt;b&gt;Address:
                      &lt;/b&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;form:input path="address" /&gt; &lt;script
                              type="text/javascript"&gt;
                          Spring.addDecoration(new Spring.ElementDecoration({
                              elementId : "address",
                              widgetType : "dijit.form.ValidationTextBox",
                              widgetAttrs : {
                                  promptMessage : "Enter Address",
                                  required : true
                              }
                          }));
                      &lt;/script&gt; &lt;br /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;font color=red&gt;&lt;form:errors path="city" /&gt;&lt;/font&gt; &lt;b&gt;City:
                      &lt;/b&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;form:input path="city" /&gt; &lt;script type="text/javascript"&gt;
                          Spring.addDecoration(new Spring.ElementDecoration({
                              elementId : "city",
                              widgetType : "dijit.form.ValidationTextBox",
                              widgetAttrs : {
                                  promptMessage : "Enter City",
                                  required : true
                              }
                          }));
                      &lt;/script&gt; &lt;br /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;font color=red&gt;&lt;form:errors path="state" /&gt;&lt;/font&gt; &lt;b&gt;State:
                      &lt;/b&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;form:input path="state" /&gt; &lt;script
                              type="text/javascript"&gt;
                          Spring.addDecoration(new Spring.ElementDecoration({
                              elementId : "state",
                              widgetType : "dijit.form.ValidationTextBox",
                              widgetAttrs : {
                                  promptMessage : "Enter State",
                                  required : true
                              }
                          }));
                      &lt;/script&gt; &lt;br /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;font color=red&gt;&lt;form:errors path="zipCode" /&gt;&lt;/font&gt; &lt;b&gt;Zip
                              Code: &lt;/b&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;form:input path="zipCode" /&gt; &lt;script
                              type="text/javascript"&gt;
                          Spring.addDecoration(new Spring.ElementDecoration({
                              elementId : "zipCode",
                              widgetType : "dijit.form.ValidationTextBox",
                              widgetAttrs : {
                                  promptMessage : "Enter Zip Code",
                                  required : true
                              }
                          }));
                      &lt;/script&gt; &lt;br /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/div&gt;
  
          &lt;input type="submit" name="_eventId_submit" id="submit" value="Submit" /&gt;
          &lt;input type="submit" name="_eventId_cancel" value="Cancel" /&gt;
          &lt;script type="text/javascript"&gt;
              Spring.addDecoration(new Spring.ValidateAllDecoration({
                  elementId : 'submit',
                  event : 'onclick'
              }));
          &lt;/script&gt;
      &lt;/form:form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>