<t:errors> out of order in T5.5

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

<t:errors> out of order in T5.5

t5_lothar
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: <t:errors> out of order in T5.5

Dmitry Gusev
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 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--
Dmitry Gusev

AnjLab Team
http://anjlab.com
Reply | Threaded
Open this post in threaded view
|

Aw: Re: <t:errors> out of order in T5.5

t5_lothar
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" <[hidden email]>
An: "Tapestry users" <[hidden email]>
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 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--
Dmitry Gusev

AnjLab Team
http://anjlab.com[http://anjlab.com]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: <t:errors> out of order in T5.5

Numa Schmeder-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/>
[hidden email] <mailto:[hidden email]>   |   M +41 79 538 30 01

DIGITAL STRATEGY   |   DESIGN   |   DEVELOPMENT


 

> Le 21 avr. 2020 à 17:13, Lothar Nieswandt <[hidden email]> 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" <[hidden email] <mailto:[hidden email]>>
> An: "Tapestry users" <[hidden email] <mailto:[hidden email]>>
> 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 <[hidden email]> 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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com[http://anjlab.com <http://anjlab.com[http://anjlab.com>]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email] <mailto:[hidden email]>
> For additional commands, e-mail: [hidden email] <mailto:[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Aw: Re: <t:errors> out of order in T5.5

t5_lothar
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" <[hidden email]>
An: "Tapestry users" <[hidden email]>
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/]>
[hidden email] <mailto:[hidden email]> | M +41 79 538 30 01

DIGITAL STRATEGY | DESIGN | DEVELOPMENT




> Le 21 avr. 2020 à 17:13, Lothar Nieswandt <[hidden email]> 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" <[hidden email] <mailto:[hidden email]>>
> An: "Tapestry users" <[hidden email] <mailto:[hidden email]>>
> 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 <[hidden email]> 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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
> --
> 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: [hidden email] <mailto:[hidden email]>
> For additional commands, e-mail: [hidden email] <mailto:[hidden email]>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: <t:errors> out of order in T5.5

Numa Schmeder-5
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/>
[hidden email] <mailto:[hidden email]>   |   M +41 79 538 30 01

DIGITAL STRATEGY   |   DESIGN   |   DEVELOPMENT


 

> Le 22 avr. 2020 à 12:44, Lothar Nieswandt <[hidden email]> 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" <[hidden email]>
> An: "Tapestry users" <[hidden email]>
> 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/]>
> [hidden email] <mailto:[hidden email]> | M +41 79 538 30 01
>
> DIGITAL STRATEGY | DESIGN | DEVELOPMENT
>
>
>
>
>> Le 21 avr. 2020 à 17:13, Lothar Nieswandt <[hidden email]> 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" <[hidden email] <mailto:[hidden email]>>
>> An: "Tapestry users" <[hidden email] <mailto:[hidden email]>>
>> 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 <[hidden email]> 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: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>> --
>> 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: [hidden email] <mailto:[hidden email]>
>> For additional commands, e-mail: [hidden email] <mailto:[hidden email]>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

Reply | Threaded
Open this post in threaded view
|

Aw: Re: <t:errors> out of order in T5.5

t5_lothar
In reply to this post by Numa Schmeder-5
You saved my day! Thank you so much!
 
Lothar 
 

Gesendet: Dienstag, 21. April 2020 um 18:49 Uhr
Von: "Numa Schmeder" <[hidden email]>
An: "Tapestry users" <[hidden email]>
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/]>
[hidden email] <mailto:[hidden email]> | M +41 79 538 30 01

DIGITAL STRATEGY | DESIGN | DEVELOPMENT




> Le 21 avr. 2020 à 17:13, Lothar Nieswandt <[hidden email]> 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" <[hidden email] <mailto:[hidden email]>>
> An: "Tapestry users" <[hidden email] <mailto:[hidden email]>>
> 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 <[hidden email]> 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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
> --
> 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: [hidden email] <mailto:[hidden email]>
> For additional commands, e-mail: [hidden email] <mailto:[hidden email]>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]