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 specifically: the AbstractRangeValidator
class) handles the comparison between min, max and actual values using
compareTo. So there should not be any issues with rounding.

Please share the code you use to initialize the relevant field, perhaps we
can spot a mistake.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 20 december 2023 bij 14:38:53, Eric Hamel (eric.ha...@albanyitg.com)
schreef:

Good morning,

We encountered an issue this morning with our use of
RangeValidator<BigDecimal>.

The customer requested a validation for amounts between 0.01 and
999,999.00.

We have a NumberTextField<BigDecimal> to which we added the RangeValidator.
If the user enters 0.01 the validation fails.

If I set the min value to 0.009 I can get it to work but the error messages
are off.

I’m wondering if it’s a rounding or scale issue but I cannot figure out how
to make the RangeValidator work.

Anyone have any insight on this ?

Thank you.
Eric H.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to