Adam Pierzchała created WICKET-4584:
---------------------------------------

             Summary: NumberTextField does not have default minimum and maximum
                 Key: WICKET-4584
                 URL: https://issues.apache.org/jira/browse/WICKET-4584
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.5.6
            Reporter: Adam Pierzchała


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?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to