hi,

the Form component was changed some time ago to 
use the "flash" persistence strategy for the ValidationTracker

from the code:
    @Persist(PersistenceConstants.FLASH)
    private ValidationTracker defaultTracker;

g,
kris




"Vjeran Marcinko" <[EMAIL PROTECTED]> 
07.07.2008 21:15
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>


An
<users@tapestry.apache.org>
Kopie

Thema
[T5] Default ValidationTracker clearing needed?







Hi all.

I posted this as a comment on some closed Jira issue, but nevertheless, I 
would like to see comments from everybody...

ValidationTracker in its current form clears its input values before 
"success" event. I guess it is done this way assuming that no error can 
happen anymore when "success" is triggered, and one doesn't want to see 
those values even if staying on same page.

Two frequent cases come to my mind when this simply doesn't hold water...

1. Cases when SOME validation is performed inside business methods, thrown 

as checked exceptions when not satisfied. This validation cannot be 
performed prior to calling business method. I don't believe that in those 
cases I should place calling the business method inside unnatural 
onValidate 
handler. I believe it should still be placed inside onSuccess, since all a 

priori validation has passed well.

Example is typical call on UserDao from within EditPage.onSuccess() method 
:

UserDao.save(User user) throws UsernameReservedException

I still have to be able to catch this exception and somehow dispay error 
with all input values still shown.

2. Frequently, when using search forms, I display search results on same 
page where form resides. Being able to show all search form criteria 
values 
is great stuff, since user can see what criteria he just entered. Since 
this 
is normal type of request flow, input values should ont be cleared before 
"success".


MY SUGGESTION:

ValidationTracker should be persisted wtih "flash" strategy, and values 
should never be cleared. If one stays on same page, regardless if there 
was 
an error (in any handler method - onValidate, onSuccess...)  or not, input 

values would still be there. If user decides to leave the page, "flash" 
strategy will ensure that these values will not be visible he comes back 
to 
this page later.
In rare cases when user wants to stay on the same page, but doesn't want 
to 
see input values, he can explicitly clear those values.

Thoughts?

-Vjeran


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


Reply via email to