Announcement Announcement Module
Collapse
No announcement yet.
How do I change the regExp in a Spring WebFlow Project with Dojo you change fieldsize Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I change the regExp in a Spring WebFlow Project with Dojo you change fieldsize

    How do I change the regExp in a Spring WebFlow Project with Dojo you change field size. I am working on a Spring WebFlow project with Dojo and I would like to change the regExp in Dojo to check that the user entered a name that is bigger then 1 digit and smaller then 10 digits. can someone please help me out with this,.



    Code:
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
        <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"%>
        <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
        
        
        
        <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"/>");
        </style>     
        
        <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>
        
        <html>
        <head>
        <title>Spring 3.0 MVC - Web Flow Example</title>
        </head>
        <body class="claro">
        	<h2>Field Size Test</h2>
        
        	<form:form commandName="customer" id="customer">
        		<input type="hidden" name="_flowExecutionKey"
        			value="${flowExecutionKey}" />
        		<div id="container">
        			<table>
        				<tr>
        					<td valign="top"><b>Name:</b></td>
        					<td valign="top"><form:input path="name" class="value" /> <script
        							type="text/javascript">
        						Spring.addDecoration(new Spring.ElementDecoration({
        							elementId : "name",
        							widgetType : "dijit.form.ValidationTextBox",
        							widgetAttrs : {
        								promptMessage : "Please Enter Your Name from 1 to 10 digits",
        								invalidMessage : "A 1 to 10 digit value is required.",
        								required : true,
        								regExp : "[0-9]{10}"
        								
        							}
        						}));
        					</script> <br />
        						<p></td>
        				</tr>
        			</table>
        		</div>
        		<p>
        		<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'
        			}));
        		</script>
        	</form:form>
        
        </body>
        </html>

  • #2
    I got it working.. All I had to do was change the following code..

    Code:
    <script
    							type="text/javascript">
    						Spring.addDecoration(new Spring.ElementDecoration({
    							elementId : "name",
    							widgetType : "dijit.form.ValidationTextBox",
    							widgetAttrs : {
    								promptMessage : "Please enter your name from 2 to 10 characters",
    								invalidMessage : "A 2 to 10 characters value is required.",
    								required : true,
    								regExp : "^[a-zA-Z]{2,10}$"
    							}
    						}));
    					</script>

    Comment

    Working...
    X