As long as you're fixing those messages, I think they have a couple
of other problems (I'm using 1.2, but it looks like 1.3 has the same
issues).
First, both messages are off by one . When you create a
MaximumValidator with a value of 3, the value is inclusive so 3 is a
valid input. But the message says '5 must be *smaller than* 3', which
doesn't include 3 itself. It should read "5 must not be greater than
3" or something along those lines.
The second point is minor, but "greater" and "smaller" are kind of
lopsided antonyms. "Bigger/smaller" or "greater/less" would be more
in sync. Something like this:
NumberValidator.minimum='${label}' must not be less than ${minimum}.
NumberValidator.maximum='${label}' must not be greater than ${maximum}.
Thanks,
-Ryan
On Jul 6, 2007, at 11:42 AM, Al Maw wrote:
The current default validation messages in Application.properties
make no logical sense.
At the moment, if you put in a value that is larger than a
NumberValidator maximum it says:
"5 must be smaller than 3"
Which it can't be, not even for very small values of 5.
To fix this, we need to do one of the following two things:
1. Change ${input} to ${label}, in which case they would all make
sense.
2. Change the text so it actually makes sense in the context of $
{input}
as in the attached patch. e.g. "5 is larger than 3.", which would
at least tell you what's currently wrong with it.
I appreciate the argument that people don't call setLabel() when
they should do, but the current set-up isn't nice.
Thoughts?
Regards,
Al
--
Alastair Maw
Wicket-biased blog at http://herebebeasties.com
Index: /home/almaw/svn/wicket/wicket-1.x/jdk-1.4/wicket/src/main/
java/org/apache/wicket/Application.properties
===================================================================
--- /home/almaw/svn/wicket/wicket-1.x/jdk-1.4/wicket/src/main/java/
org/apache/wicket/Application.properties (revision 553981)
+++ /home/almaw/svn/wicket/wicket-1.x/jdk-1.4/wicket/src/main/java/
org/apache/wicket/Application.properties (working copy)
@@ -15,18 +15,18 @@
Required=Field '${label}' is required.
IConverter='${input}' is not a valid ${type}.
-NumberValidator.range=${input} must be between ${minimum} and $
{maximum}.
-NumberValidator.minimum='${input}' must be greater than ${minimum}.
-NumberValidator.maximum='${input}' must be smaller than ${maximum}.
+NumberValidator.range=${input} is not between ${minimum} and $
{maximum}.
+NumberValidator.minimum='${input}' is smaller than ${minimum}.
+NumberValidator.maximum='${input}' is larger than ${maximum}.
-StringValidator.range='${input}' must be between ${minimum} and $
{maximum} characters.
-StringValidator.minimum='${input}' must be at least ${minimum}
characters.
-StringValidator.maximum='${input}' must be at most ${maximum}
characters.
-StringValidator.exact='${input}' must be ${exact} characters long.
+StringValidator.range='${input}' is not between ${minimum} and $
{maximum} characters.
+StringValidator.minimum='${input}' is less than ${minimum}
characters.
+StringValidator.maximum='${input}' is more than ${maximum}
characters.
+StringValidator.exact='${input}' is not exactly ${exact}
characters long.
-DateValidator.range='${input}' must be between ${minimum} and $
{maximum}.
-DateValidator.minimum='${input}' must be greater than ${minimum}.
-DateValidator.maximum='${input}' must be smaller than ${maximum}.
+DateValidator.range='${input}' is not between ${minimum} and $
{maximum}.
+DateValidator.minimum='${input}' is less than ${minimum}.
+DateValidator.maximum='${input}' is larger than ${maximum}.