You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Lothar Nieswandt <lo...@gmx.de> on 2020/04/09 15:59:30 UTC
out of order in T5.5
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Aw: Re: out of order in T5.5
Posted by Lothar Nieswandt <lo...@gmx.de>.
You saved my day! Thank you so much!
Lothar
Gesendet: Dienstag, 21. April 2020 um 18:49 Uhr
Von: "Numa Schmeder" <nu...@dfacto.ch>
An: "Tapestry users" <us...@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/]>
NUMA@DFACTO.CH <ma...@dfacto.ch> | M +41 79 538 30 01
DIGITAL STRATEGY | DESIGN | DEVELOPMENT
> Le 21 avr. 2020 à 17:13, Lothar Nieswandt <lo...@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.gusev@gmail.com <ma...@gmail.com>>
> An: "Tapestry users" <users@tapestry.apache.org <ma...@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 <lo...@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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org <ma...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org <ma...@tapestry.apache.org>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: out of order in T5.5
Posted by Numa Schmeder <nu...@dfacto.ch>.
Hi Lothar,
Just remove
>> return indexPage;
in your listener and you will avoid a redirect, it will render the same page and you won’t loose your ValidationTracker state.
Best,
<http://www.dfacto.ch/> Numa Schmeder www.dfacto.ch <http://www.dfacto.ch/>
NUMA@DFACTO.CH <ma...@dfacto.ch> | M +41 79 538 30 01
DIGITAL STRATEGY | DESIGN | DEVELOPMENT
> Le 22 avr. 2020 à 12:44, Lothar Nieswandt <lo...@gmx.de> a écrit :
>
> 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" <nu...@dfacto.ch>
> An: "Tapestry users" <us...@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/]>
> NUMA@DFACTO.CH <ma...@dfacto.ch> | M +41 79 538 30 01
>
> DIGITAL STRATEGY | DESIGN | DEVELOPMENT
>
>
>
>
>> Le 21 avr. 2020 à 17:13, Lothar Nieswandt <lo...@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.gusev@gmail.com <ma...@gmail.com>>
>> An: "Tapestry users" <users@tapestry.apache.org <ma...@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 <lo...@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-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org <ma...@tapestry.apache.org>
>> For additional commands, e-mail: users-help@tapestry.apache.org <ma...@tapestry.apache.org>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
Aw: Re: out of order in T5.5
Posted by Lothar Nieswandt <lo...@gmx.de>.
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" <nu...@dfacto.ch>
An: "Tapestry users" <us...@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/]>
NUMA@DFACTO.CH <ma...@dfacto.ch> | M +41 79 538 30 01
DIGITAL STRATEGY | DESIGN | DEVELOPMENT
> Le 21 avr. 2020 à 17:13, Lothar Nieswandt <lo...@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.gusev@gmail.com <ma...@gmail.com>>
> An: "Tapestry users" <users@tapestry.apache.org <ma...@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 <lo...@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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org <ma...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org <ma...@tapestry.apache.org>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: out of order in T5.5
Posted by Numa Schmeder <nu...@dfacto.ch>.
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/>
NUMA@DFACTO.CH <ma...@dfacto.ch> | M +41 79 538 30 01
DIGITAL STRATEGY | DESIGN | DEVELOPMENT
> Le 21 avr. 2020 à 17:13, Lothar Nieswandt <lo...@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.gusev@gmail.com <ma...@gmail.com>>
> An: "Tapestry users" <users@tapestry.apache.org <ma...@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
>
> 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 <lo...@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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com[http://anjlab.com <http://anjlab.com[http://anjlab.com>]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org <ma...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org <ma...@tapestry.apache.org>
Aw: Re: out of order in T5.5
Posted by Lothar Nieswandt <lo...@gmx.de>.
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" <dm...@gmail.com>
An: "Tapestry users" <us...@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
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 <lo...@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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Dmitry Gusev
AnjLab Team
http://anjlab.com[http://anjlab.com]
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: out of order in T5.5
Posted by Dmitry Gusev <dm...@gmail.com>.
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
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 <lo...@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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Dmitry Gusev
AnjLab Team
http://anjlab.com