Announcement Announcement Module
Collapse
No announcement yet.
Validation.xml Regex Syntax Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Validation.xml Regex Syntax

    I am trying to validate a text area with a regex but I am unsure of the syntax. I have attached an image of the web page.

    Here is the relevant code from the velocity template:

    Code:
    <div>
    
    <label for='attention'>#springMessage("globals.attention") </label>
    #springFormInput("addressFormBean.attention")
    
    </div>
    
    <div>
    
    <label for='orderNotes'>#springMessage("globals.ordernotes") </label>
    #springFormTextarea("addressFormBean.orderNotes" "regex='/[^A-Za-z\d\s]/'")#springShowErrors("<br>" "req")
    
    </div>
    Here is the relevant code from the Validation.xml file (orderNotes is the last field tag):

    Code:
    </form>	
    	<form name="addressFormBeanImpl">
    	        <field property="newAddress.firstName" depends="securityCheck,required,maxlength">
    		    <arg0 key="globals.firstname" />
    		    <arg1 name="maxlength" key="${var:maxlength}" resource="false" />
    		    <var>
                            <var-name>maxlength</var-name>
                            <var-value>100</var-value>
                        </var>
    		</field>
    
    		<field property="newAddress.lastName" depends="securityCheck,required,maxlength">
    		    <arg0 key="globals.lastname" />
    		    <arg1 name="maxlength" key="${var:maxlength}" resource="false" />
    		    <var>
                            <var-name>maxlength</var-name>
                            <var-value>100</var-value>
                        </var>
    		</field>
    		<field property="newAddress.street1" depends="securityCheck,required,maxlength">
    		    <arg0 key="globals.street1" />
     		    <arg1 name="maxlength" key="${var:maxlength}" resource="false" />
    		    <var>
                            <var-name>maxlength</var-name>
                            <var-value>200</var-value>
                        </var>
    		</field>
    		<field property="newAddress.street2" depends="securityCheck,maxlength">
    		    <arg0 key="globals.street2" />
    		    <arg1 name="maxlength" key="${var:maxlength}" resource="false" />
    		    <var>
                            <var-name>maxlength</var-name>
                            <var-value>200</var-value>
                        </var>
    		</field>
    		<field property="newAddress.city"  depends="securityCheck,required,maxlength">
    		    <arg0 key="globals.city" />
    		    <arg1 name="maxlength" key="${var:maxlength}" resource="false" />
    		    <var>
                            <var-name>maxlength</var-name>
                            <var-value>100</var-value>
                        </var>
    		</field>
    		<field property="newAddress.country" depends="securityCheck,required">
                        <arg0 key="globals.country" />
                    </field>
    		<field property="newAddress.subCountry" depends="securityCheck,subCountryRequired">
    		    <arg0 key="globals.subcountry" />
    		    <var>
                            <var-name>countryProperty</var-name>
                            <var-value>newAddress.country</var-value>
                        </var>
    		</field>
    		<field property="newAddress.zipOrPostalCode" depends="securityCheck,required,maxlength">
    		    <arg0 key="globals.zippostalcode" />
    		    <arg1 name="maxlength" key="${var:maxlength}" resource="false" />
    		    <var>
                            <var-name>maxlength</var-name>
                            <var-value>50</var-value>
                        </var>
    		</field>		
    		<field property="orderNotes" depends="securityCheck,required">
    		    <arg0 key="globals.ordernotes" />
    		    <arg1 name="regex" key="${var:regex}" resource="false" />
    		    <var>
    		        <var-name>regex</var-name>
    		        <var-value>/[^A-Za-z\d\s]/</var-value>
    		    </var>
    	        </field>
    </form>
    Thanks in advance,
    Andres
Working...
X