I've just tested the scenario of being redirected after a validation failure
using the quickstart Archetype and the code below.
I can see that tapestry is performing a redirect after the onValidateForm
even though the form has errors.

Is the only solution to persist the form data to a database?


public class Index {
    public void onActivate() {
        System.out.println("On Activate");
    }

    @OnEvent(component = "form", value = "validateForm")
    public void onValidateForm() {
        System.out.println("On Validate Form");
        form.recordError("This is an error");
    }

    @Component
    @Property
    private Form form;
    @Property
    private String name;
}

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
    <head>
        <title>test Start Page</title>
    </head>
    <body>
        <h1>test Validation</h1>

        <t:form id="form">
            <t:textField id="name" value="name"/>
            <t:submit value="submit"/>
        </t:form>

        <t:if test="form.hasErrors">
            Form has errors
        </t:if>
    </body>
</html>

Reply via email to