Re: RangeValidator and BigDecimal

2023-12-20 Thread Eric Hamel
Sven, Thanks I hit send by mistake. It became clear that it was a BigDecimal instantiation issue and nothing to do with the RangeValidator. Thanks all. On Wed, Dec 20, 2023 at 9:25 AM Sven Meier wrote: > Hi Eric, > > you can read in the javadoc, why your first solution is 'unpredictable': > >

Re: RangeValidator and BigDecimal

2023-12-20 Thread Bas Gooren
Hi all, Yeah, that was easy to spot: BigDecimal is only accurate when provided with a string or fixed input (e.g. integer or long). Doubles and floats are inherently inaccurate (as they are non-exact values). So if you change your code to ... testField.setMinimum(new BigDecimal(“0.01")); … it

Re: RangeValidator and BigDecimal

2023-12-20 Thread Sven Meier
Hi Eric, you can read in the javadoc, why your first solution is 'unpredictable': https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/math/BigDecimal.html#%3Cinit%3E(double) Sven On 20.12.23 15:18, Eric Hamel wrote: Hi Bas, Thanks for the response. I discovered the

Re: RangeValidator and BigDecimal

2023-12-20 Thread Eric Hamel
Hi Bas, Thanks for the response. I discovered the NumberTextField had its own RangeValidator 2 seconds after posting. With that said, I’m getting the same issue when using it. To be clear, I’m not getting any Exceptions, everything seems to work fine, but the form validation fails if the user

Re: RangeValidator and BigDecimal

2023-12-20 Thread Bas Gooren
Hi Eric, First off: according to the source of NumberTextField, it automatically adds a RangeValidator (see NumberTextField#onConfigure). So you shouldn’t need to add the RangeValidator yourself. Regarding your problem: what kind of error messages are you getting? The range validator (or more

RangeValidator and BigDecimal

2023-12-20 Thread Eric Hamel
Good morning, We encountered an issue this morning with our use of RangeValidator. The customer requested a validation for amounts between 0.01 and 999,999.00. We have a NumberTextField to which we added the RangeValidator. If the user enters 0.01 the validation fails. If I set the min