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" <[email protected]>
An: "Tapestry users" <[email protected]>
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 <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
Dmitry Gusev
AnjLab Team
http://anjlab.com[http://anjlab.com]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]