Announcement Announcement Module
No announcement yet.
How to make checkboxs required in a Spring WebFlow Project with Dojo Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to make checkboxs required in a Spring WebFlow Project with Dojo

    How to make checkboxs required in a Spring WebFlow Project with Dojo. I would like to know how to make the checkbox required on submit of the following page. I don't want the submit to work if the user did not click one of the check box options. thanks.

      <%@ taglib prefix="c" uri=""%>
        <%@ taglib prefix="fmt" uri=""%>
        <%@ taglib prefix="form" uri=""%>
        <style type="text/css" media="screen">
         @import url("<c:url value="/resources/dojo/resources/dojo.css"/>");
         @import url("<c:url value="/resources/dijit/themes/claro/claro.css"/>");
        <script djconfig="parseOnLoad: true"
         src="<c:url value="/resources/dojo/dojo.js"/>" type="text/javascript"></script>
        <script type="text/javascript"
         src="<c:url value="/resources/spring/Spring.js" />"> </script>
        <script type="text/javascript"
         src="<c:url value="/resources/spring/Spring-Dojo.js" />"></script>
        <script type="text/javascript">dojo.require("dojo.parser");</script>
        <title>Spring 3.0 MVC - Web Flow Example</title>
        <body class="claro">
        	<h2>Dropdown Test</h2>
        	<form:form commandName="customer" id="customer">
        		<input type="hidden" name="_flowExecutionKey"
        			value="${flowExecutionKey}" />
        		<div id="container">
        					<td><font color=red><form:errors path="sex" /></font><b>Sex:</b></td>
        					<td><form:checkbox path="sex" id="sex" value="MALE" /> Male - 
        					    <form:checkbox path="sex" id="sex" value="FEMALE" />FEMALE
        					    <script type="text/javascript">
        							dojo.query("#sex input[type='checkbox']").forEach(function(element){
        								Spring.addDecoration(new Spring.ElementDecoration({
        									widgetType : "dijit.form.CheckBox",
        									widgetAttrs : { checked : element.checked, required : true }
        		<input type="submit" name="_eventId_submit" id="submit" value="Submit" />
        		<input type="submit" name="_eventId_cancel" value="Cancel" />
        		<script type="text/javascript">
        			Spring.addDecoration(new Spring.ValidateAllDecoration({
        				elementId : 'submit',
        				event : 'onclick'