You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Chris <ch...@yahoo.fr> on 2013/09/16 13:28:59 UTC

validator type="regex" : param name is regex , not expression

Hi Lukasz,

Good example of regex in http://struts.apache.org/development/2.x/docs/form-validation-using-xml.html ,  
and choose  between JavaScript validator or Java validator will be another story .;-)


but the file EditAction-validation.xml seems contain a wrong value.
. 

I found it in testing PhoneNumber with many wrong values and it always worked !
I thought maybe a jar is missing ? 

But it was the param name in the file EditAction-validation.xml
-> <param name="expression"> should be <param name="regex">

before
<validator type="regex">
    <param name="fieldname">personBean.phoneNumber</param>
    <param name="expression"><![CDATA[\d{3}-\d{3}-\d{4}]]></param>
    <message>Phone number must be entered as 999-999-9999.</message>
</validator>

after 
<validator type="regex">
    <param name="fieldname">personBean.phoneNumber</param>
    <param name="regex"><![CDATA[\d{3}-\d{3}-\d{4}]]></param>
    <message>Phone number must be entered as 999-999-9999.</message>
</validator>




Regards,

Chris ( christalkto ) 


________________________________

Re: validator type="regex" : param name is regex , not expression

Posted by Lukasz Lenart <lu...@apache.org>.
Done, thanks for reporting!

https://cwiki.apache.org/confluence/display/WW/Form+Validation+Using+XML

2013/9/16 Chris <ch...@yahoo.fr>:
> Hi Lukasz,
>
> Good example of regex in http://struts.apache.org/development/2.x/docs/form-validation-using-xml.html ,
> and choose  between JavaScript validator or Java validator will be another story .;-)
>
>
> but the file EditAction-validation.xml seems contain a wrong value.
> .
>
> I found it in testing PhoneNumber with many wrong values and it always worked !
> I thought maybe a jar is missing ?
>
> But it was the param name in the file EditAction-validation.xml
> -> <param name="expression"> should be <param name="regex">
>
> before
> <validator type="regex">
>     <param name="fieldname">personBean.phoneNumber</param>
>     <param name="expression"><![CDATA[\d{3}-\d{3}-\d{4}]]></param>
>     <message>Phone number must be entered as 999-999-9999.</message>
> </validator>
>
> after
> <validator type="regex">
>     <param name="fieldname">personBean.phoneNumber</param>
>     <param name="regex"><![CDATA[\d{3}-\d{3}-\d{4}]]></param>
>     <message>Phone number must be entered as 999-999-9999.</message>
> </validator>
>
>
>
>
> Regards,
>
> Chris ( christalkto )
>
>
> ________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org