You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Hunter Kelly <hk...@newbay.com> on 2004/03/03 12:46:44 UTC

Best way to share validation information

Hi there, I have a situation like this:


Scenario 1:

user tries to log in on pageX
Validation needs to happen (explained below)
  If success, user goes to destination page
  If failure, user goes to login page with appropriate errors

Scenario 2:

user tries to log in on login page
Exact same validation needs to happen
Same results as above

Now I'm trying to re-use the ValidFields and ValidationDelegate stuff
so that when the post happens on pageX, and there is invalid input, 
the login page doesn't have to revalidate.  In fact, what I'd like
to do is actually share the same instance of the ValidationDelegate.

I'm thinking I can put the ValidationDelegate and the appropriate
validators in a template-less component, have pageX and login both
have one of these components, and then the component itself can
have the smart logic about making sure that only one instance of 
the delegate exists per request, and have the listener for the form
submit so that the logic isn't duplicated anywhere.


Does this sound like I'm on the right track, or is there a
more obvious way to do this, or a more tapestry like way, or...?

Thanks,

H





---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org