-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Oren,

Oren Livne wrote:
> Dear Chris:
> Yes, other validations are working. For instance, I also have an
> "intRange" validation on the same integer field. If I type a letter for
> the integer field, it sets it to 0, displays it as 0, and says it's
> outside the permissible range (which happens to be 1-4). No errors on
> startup. Any idea what could go wrong? :(
> 
> Should I use a String instead of int in my form for that field?

I pretty much always use strings.

If you have your field type set to "java.lang.Integer", then its value
will be either null of an actual number. It's possible that the
converter used by the validator will set an invalid input to new
Integer(0) just as a default value. So, for instance, if you enter "foo"
in for a number, it comes back "0", when it should have been "foo" (at
least, I would expect it to say "foo" and an error message).

IMHO, a rejected form should come back to the user in exactly the same
way it was submitted (plus error messages, of course).

Using strings for all form fields /will/ work, but I'm not entirely sure
it's necessary to make that happen. I just know that it works for me.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF6c0b9CaO5/Lv0PARAt6qAJ49qun09ehwDYu0lpva3Cvyy0c7EACglUF2
fLHeh3/nKs3iQ2sgPG5XBXA=
=jdT/
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to