Re: regex validator and BigDecimal

2008-08-25 Thread ndario



I should have said that I do have custom BigDecimal converter which throws
TypeConversionException if conversion fails. 

But users are still allowed to enter something like "344,5,6" which converts
successfuly but converted value may not be the one user wanted to enter.
That is why i want to give a warning that format is incorrect. 

I guess that cannot be done with regex validator and BigDecimal?

-- 
View this message in context: 
http://www.nabble.com/regex-validator-and-BigDecimal-tp19142200p19145282.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: regex validator and BigDecimal

2008-08-25 Thread Oleg Mikheev

ndario wrote:

Is there any way to validate the string before conversion to BigDecimal?


The right (and default) way of handling conversion errors is to
use the Conversion Error Interceptor:
http://struts.apache.org/2.x/docs/conversion-error-interceptor.html

There is no converter for BigDecimal, but it takes almost no
effort to create one:
http://struts.apache.org/2.0.11.2/docs/type-conversion.html


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: regex validator and BigDecimal

2008-08-25 Thread ealden
If the conversion to BigDecimal fails that either means that the input
is blank of invalid. Would you get the same effect as a regex
validatir if you made the BigDecimal property a required field?

On 8/25/08, ndario <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I am trying to enforce BigDecimal number format with regex validator but
> validation simply does nothing. If I apply the same validator to the String
> property, validator works but for some reason does not work with BigDecimal.
> I guess the reason is that validation is applied to converted BigDecimal
> object but not on the string which user entered.
>
> Is there any way to validate the string before conversion to BigDecimal?
>
> thanks!
>
> Dario
> --
> View this message in context:
> http://www.nabble.com/regex-validator-and-BigDecimal-tp19142200p19142200.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Ealden Esto E. EscaƱan
http://blog.ealden.net

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]