On 08/18/2009 07:11 AM, Pete Muir wrote:
On 17 Aug 2009, at 22:25, Ed Burns wrote:
> PM> I believe to address both (1) and (2) we have to
address this problem
> PM> anyway, as I would be very unhappy to end up with the worst case
> PM> scenario of: conversion failures -> return to user -> property
> PM> validation failures -> return to user -> cross component
> validation -
> PM> return to user ->
business logic error -> return to user -> render
> PM> next page.
> Pete, I don't see any way around having to go back to
the user. I think
> first class client side validation can make this painless.
Yes, I think this is an acceptable approach, especially given that we
make Ajax validation easy.
Ajax ( or client-side ) validation could reduce a number
of requests,
but I prefer to perform as many checks during single request as it
possible. At least, conversation error in one field should not disable
validation for any other there are no conversation errors, and
cross-component check should not be skipped for valid input values as
well. Frankly, I hate a web page design that give me errors one by one
during consequence form submits.
fields that keeps converted value for different validation stages seems
is necessary for inter-component validation. Incorrect validator calls
for field that had conversation error is not a concert, because UIInput
already has 'valid' attribute that value prevents further validation calls.
> Of course,
> we would still do the same validation on the server side. I think this
> could possibly be accomodated with a JSF specific JSR-303 annotation
> that is somehow indicated at the point of the constraint declaration.
> Something like
> public class UserBean {
> @Email
> @AlsoRunOnClient
> string email;
> public String getEmail() {...}
> public void setEmail() {...}
> }
> We'd have another bunch of stuff in the jsf.js file,
but that's why we
> have staked it out, so we can add stuff to it.
Yes, that is another topic we need to address IMO - adding a generic
client side validation framework to JSF, on top of which we build
support for JSR-303 client side validation (Emmanuel and I ensured that
303 would support client side validation in a generic sense).
I guess JSR-303 could
helps with inter-component validation as well. It
already has a single property check that does not require model update (
validateValue ). It would be wonderful to have a similar functionality
that allows to check a couple of properties in the same way. Something like:
beanValidator.validateValues(bean,"foo",fooValue,"bar.baz",bazValue"....
).
I think Alex was working on a prototype for this at some point?
I have a plan to