You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by David Roberts <dl...@ukonline.co.uk> on 2008/05/27 08:41:27 UTC

Event Order Patterns?

OK,  so if I press the submit button on a form, events fire in the 
following order:

validate
success / failure
submit

As I understand it the patterns for using these events are:

validate - validate code and add errors to form object if validation 
errors occur
success - redirect to another page, if required
submit - ? persist objects to backing store?

Of course, the problem here is that if I redirect to another page then, 
under this pattern, I do not get the opportunity to persist the data.  
Any thoughts on what sort of code should go where would be appreciated - 
particularly on what the submit event is for, considering that it comes 
after a potential change of page and also where I should put the 
persistence/hibernate code.

Thanks,   David.

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


Re: Event Order Patterns?

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi,

validate was renamed to validateForm a while ago - validate is now an 
event thta fires for each field in the form.

I actually don't use submit for anything - it's perfectly fine to 
persist your data etc. in success and then redirect.

Hope this helps.

-Filip

David Roberts skrev:
> OK,  so if I press the submit button on a form, events fire in the 
> following order:
> 
> validate
> success / failure
> submit
> 
> As I understand it the patterns for using these events are:
> 
> validate - validate code and add errors to form object if validation 
> errors occur
> success - redirect to another page, if required
> submit - ? persist objects to backing store?
> 
> Of course, the problem here is that if I redirect to another page then, 
> under this pattern, I do not get the opportunity to persist the data.  
> Any thoughts on what sort of code should go where would be appreciated - 
> particularly on what the submit event is for, considering that it comes 
> after a potential change of page and also where I should put the 
> persistence/hibernate code.
> 
> Thanks,   David.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

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