Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.5.6
-
None
Description
Javadoc of NumberTextField says:
A TextField for HTML5 <input> with type number.
Automatically validates the input against the configured min and max attributes. If any of them is null then Double.MIN_VALUE and Double.MAX_VALUE are used respectfully. Note: FormComponent.setType(Class) must be called explicitly!
It is not true. We have constructor which sets them to null:
public NumberTextField(String id, IModel<N> model, Class<N> type)
{ super(id, model, type); validator = null; minimum = null; maximum = null; }and if I don't set them manually, in case of error nulls go to RangeValidator (line 84-85:
error.setVariable("minimum", min);
error.setVariable("maximum", max);
causing:
java.lang.IllegalArgumentException: Argument 'value' may not be null.
Nevertheless, I think reflection API should be used to determine if given Number has MAX_VALUE/MIN_VALUE and this one should be used. In other case I think it is ok to use Double.MAX_VALUE/MIN_VALUE.
or maybe you have another ideas?