Short-circuiting validation when a type conversion error occurs
emilsebastian <[email protected]> Tue, 12 Dec 2006 04:13:55 CST
| Newsgroups | gmane.comp.java.open-symphony.webwork |
|---|---|
| Message-ID | <20092384.1165918663207.JavaMail.os-j2ee@opensymphony01.managed.contegix.com> |
Hi,
I am having troubles with error reporting and wonder if there is a way to short-circuit validation when a type conversion error occurs?
In my POJO (Service.java), "level" is an int property and in order to let the user edit this property, I am using a standard ww:textfield
In my validation xml-file I am using a standard int field-validator:
[code]
<field name="service.level">
<field-validator type="int">
<param name="min">1</param>
<param name="max">5</param>
<message>Value must be in the range 1 to 5</message>
</field-validator>
</field>
[/code]
My problem is that I don't want the validation errors to be displayed if there has been a type conversion error. Just like the short-circuit attribute can be used to make sure only one validation error gets displayed, I would like to only have either the conversion error displayed or - if the type conversion succeeds - the validation error (assuming the entered value is incorrect).
I have also tried to add a conversion field-validator, but when a type conversion error occurs both the standard type conversion error message ("Invalid field value for field ...") and the validation error message are displayed.
Do I have to turn off the global conversion error reporting and add conversion field-validators to my fields, or is there another way? To me it doesn't really make sense to try validating a value that is not even of the correct type.
/Emil
(I am using WW 2.2.4 and Jetty 6 on Windows 2000)
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53139&messageID=106879#106879
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]