Hi Numa,

I'm a little confused. Until T5.3, the handling of ValidationTracker instances 
and their attachment to the request context was completely under control of the 
framework. Has this now changed? The code snippet I provided in my last mail 
was from Form.java which belongs to the Tapestry core.

Second thing: according to the documentation the post-redirect pattern that had 
been used for form submission until T5.3 has now been replaced by an 
in-request-processing approach. Knowing this it makes even less sense to 
manually control the ValidationTracker persistence.

Any thoughts?

Lothar


Gesendet: Dienstag, 21. April 2020 um 18:49 Uhr
Von: "Numa Schmeder" <n...@dfacto.ch>
An: "Tapestry users" <users@tapestry.apache.org>
Betreff: Re: <t:errors> out of order in T5.5
Hi Lothar,

I you redirect after form submission without persisting the ValidationTracker 
you will loose it’s content.
Therefor you need to persist between requests or you shouldn’t redirect after 
submit.

Best regards,


<http://www.dfacto.ch/> Numa Schmeder www.dfacto.ch[http://www.dfacto.ch] 
<http://www.dfacto.ch/[http://www.dfacto.ch/]>
n...@dfacto.ch <mailto:n...@dfacto.ch> | M +41 79 538 30 01

DIGITAL STRATEGY | DESIGN | DEVELOPMENT




> Le 21 avr. 2020 à 17:13, Lothar Nieswandt <lothar_n...@gmx.de> a écrit :
>
> Hi Dimitry,
>
> thanks for your advice which pointed me to the right resources. However, my 
> problem is not solved yet.
>
> It's not that my validation code is skipped. I can put it in either 
> onValidate() or onLogin() and I can step through it in the debugger.
>
> The thing is: the results don't get displayed by <t:errors>. The reason for 
> that seems to be that <t:errors> uses a different instance of 
> ValidationTracker. Why is that?
>
> In Form.java I found:
>
> /**
> * Starting in 5.4, this is a simple, non-persistent property, with no extra 
> magic tricks.
> */
> private ValidationTracker defaultTracker;
>
> Does this mean that I have to take care of the persistence of 
> ValidationTracker myself? How can I do that?
>
> Best regards,
> Lothar
>
>
>
> Gesendet: Donnerstag, 09. April 2020 um 18:07 Uhr
> Von: "Dmitry Gusev" <dmitry.gu...@gmail.com <mailto:dmitry.gu...@gmail.com>>
> An: "Tapestry users" <users@tapestry.apache.org 
> <mailto:users@tapestry.apache.org>>
> Betreff: Re: <t:errors> out of order in T5.5
> Hi Lothar,
>
> There were some changes in the form submission logic in Tapestry 5.4:
>
> http://tapestry.apache.org/forms-and-validation.html#FormsandValidation-TrackingValidationErrors[http://tapestry.apache.org/forms-and-validation.html#FormsandValidation-TrackingValidationErrors]
>
> Try to move the login logic to onValidate() and see if it makes any
> difference.
>
> Regards,
> Dmitry
>
> On Thu, Apr 9, 2020 at 4:59 PM Lothar Nieswandt <lothar_n...@gmx.de> wrote:
>
>> Hello everybody,
>>
>> I have now migrated my Tapestry 5.3 application to Tapestry 5.5, which is
>> now final. Thanks a lot, it makes me feel much more confident about the
>> future applicability of Tapestry.
>>
>> One remaining issue: it seems to me like the <t:errors> component does not
>> work anymore.
>>
>> I can record anything I want by means of form.recordError(), but it does
>> not get displayed anymore. At first I thought it could be a client side
>> validation or CSS/bootstrap issue, but now I think, there must be server
>> side cause?
>>
>> <html ...>
>> <t:form t:id="loginForm" validate="this">
>>>>> <t:errors/>
>> <div class="table">
>> <div class="tr">
>> <div class="td">Benutzername:</div>
>> <div class="td"><t:textfield
>> t:id="username"/></div>
>> </div>
>> <div class="tr">
>> <div class="td">Kennwort:</div>
>> <div class="td"><t:passwordfield
>> t:id="password"/></div>
>> </div>
>> </div>
>> <p/>
>> <t:submit t:id="login" t:event="login" value="Anmelden"
>> class="button"/>
>> </t:form>
>> </html>
>>
>>
>> public class Index extends BasePage {
>>
>> @Property
>> @NotNull
>> private String username;
>> @Property
>> @NotNull
>> private String password;
>> @Inject
>> private LocalLoginService loginService;
>> @InjectPage
>> private Menu indexPage;
>> @SessionState
>> private UserData user;
>> @Component
>> private Form loginForm;
>> Object onLogin() {
>> Session session = loginService.login(username, password);
>> if (session == null) { // authentication failed
>>>>> loginForm.recordError("Die verwendeten Anmeldedaten sind
>> ungültig.");
>> return this;
>> }
>> user.setPrincipal(session.getPrincipal());
>> user.setRealname(session.getRealname());
>> return indexPage;
>> }
>> }
>>
>> This worked perfectly in T5.3, but not in T5.5.
>>
>> Any ideas?
>> Lothar
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com[http://anjlab.com][http://anjlab.com[http://anjlab.com] 
> <http://anjlab.com[http://anjlab.com][http://anjlab.com[http://anjlab.com]>]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org 
> <mailto:users-unsubscr...@tapestry.apache.org>
> For additional commands, e-mail: users-h...@tapestry.apache.org 
> <mailto:users-h...@tapestry.apache.org>

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

Reply via email to