struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Siddiq Syed <siddiq...@yahoo.com>
Subject Re: Trim for regex validator is not working
Date Wed, 13 May 2009 20:46:29 GMT

Hi Dave, 

I tried setting trim="true" , I donno why some how its not working.

I am searching for the regular expression, which ignore white spaces but no
sucess so far.

Any idea ?

Thanks
siddiq.


newton.dave wrote:
> 
> Siddiq Syed wrote:
>> Do anybody have an idea why this is not working.
>> There is validation for a numeric field which is a string in the action ,
>> The validation is through regular expression as show below.
>> 
>> <field name="caseNumber">
>> 	<field-validator type="requiredstring">
>> 		<message>Please enter a case number</message>
>> 	</field-validator>
>> 	<field-validator type="regex">
>>   		[0-9]{1,}
>>  	    <message>Please enter a valid case number</message>
>> 	</field-validator>	
>> </field>
>> 
>> As per struts  
>> http://struts.apache.org/2.1.6/docs/regex-validator.html  the default
>> value
>> for trim is true,
>> 
>> The problem is validation is not happening if I give a space either at
>> the
>> begining or at the ending of the case number in the text filed, basically
>> trim is not working for this field.
>> 
>> Do any body have any idea how to set trim to work. Or any other regular
>> expression where it can trim the the white spaces.
> 
> Did you try setting trim to true?
> 
> Any reasonable regex tutorial will give you the syntax for ignoring 
> arbitrary quantities of whitespace.
> 
> Dave
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Trim-for-regex-validator-is-not-working-tp23528434p23529634.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message