Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1336

NumberValidator.POSITIVE gives an intimidating error message

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.3.1
    • 1.3.2
    • wicket
    • None

    Description

      Here's the code I was using for my TextField:
      form.add(new TextField("input_text", new PropertyModel(this, "inputText"), Integer.class)
      .add(NumberValidator.POSITIVE)
      .setRequired(true));

      If you type "-1" on the form, it gives you this error message:
      '-1' is smaller than the minimum of 4.9E-324.

      The work around to this is to use NumberValidator.minimum(0) instead. That, as far as I can tell, works the same way but gives this error message:
      '-1' is smaller than the minimum of 0.

      I think the user would prefer to see that.

      Attachments

        Activity

          People

            jcompagner Johan Compagner
            tietyt Daniel Kaplan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: