In my database I have changed the type of a field from VARCHAR to DECIMAL. Therefore I have change the type in the java model class from String to BigDecimal.
In my previous XML validation file I have a requiredString fieldValidator. If I leave it, everytime I enter the value (a big decimal) in the form field, the requiredString fieldValidator fires. (maybe a problem with the param interceptor that should convert String to BigDecimal).
Anyway for the same field, I have another field validator which is a REGEX.
So I thought that if I dont use the requieredString, just the regex validator it would work, but not. If i dont fill the field up, no error fires.
So.. to sum up :
my action has a field from the Beneficiary class. In the Beneficiairy class I have a BigDecimal field. my xml validation file is like that for this field :
<field name="benef.nirBenef">
<field-validator type="regex">
<param name="expression"><![CDATA[^(1|2)\d{14}$]]></param>
<message key="error.securityNumber"/>
</field-validator>
when the field is empty, the validation says it is all right.
why ?
when if I use the requiredstring validator, the validation says it is wrong even though the value is good
Thank you