You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Al...@bmo.com on 2003/07/15 22:51:58 UTC

mask validation.

Hi there,

I am doing a mask validation for the phone - using the 'standard' regex 
pattern:

                <constant>
                        <constant-name>phone</constant-name>
                        <constant-value>^(\d{3})[-| ]?(\d{4})$</constant-value>
                </constant> 

.....
.....

                        <field property="workphone" depends="mask">
                                <arg0 key="orderforeign.workphone.label"/>
                                <var>
                                        <var-name>mask</var-name>
                                        <var-value>${phone}</var-value>
                                </var> 
                        </field>

Now, I have noticed that if no phone number is entered, it passes the 
Javascript
validation (I  have no "required" validation dependency for this field). 
So, Javascript
let's it go, but, the Server side validation fails - so it displays an 
error message saying
that no phone number has been entered.  What gives??  Why am I getting a 
'server side'
validation error and Javascript seems to let it go.  Perhaps I should 
change the regex
pattern to allow empty string, but I am not sure how to do that.  I am 
using IBM WSAD 5.0x

Thanks, Aleks.