Wicket
  1. Wicket
  2. WICKET-1336

NumberValidator.POSITIVE gives an intimidating error message

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.3.2
    • Component/s: wicket
    • Labels:
      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.

        Activity

        Hide
        Johan Compagner added a comment -

        i changed it so that now the resource key are:

        NumberValidator.positive='$

        {input}' must be positive.
        NumberValidator.negative='${input}

        ' must be negative.

        so the text different now. I only updated english and dutch so the rest has to come when time passes

        Show
        Johan Compagner added a comment - i changed it so that now the resource key are: NumberValidator.positive='$ {input}' must be positive. NumberValidator.negative='${input} ' must be negative. so the text different now. I only updated english and dutch so the rest has to come when time passes

          People

          • Assignee:
            Johan Compagner
            Reporter:
            Daniel Kaplan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development