Hi everyone,

I have some problem with t:if

It's my form in Start.tml

<t:form>
    <t:errors/>
    <t:checkbox value="check"/>
    <t:if test="check">
        Hello
    </t:if>
    <t:submit/>
</t:form>

It's my Start.java

public class Start
{
    @Property
    private boolean check;

    @Environmental
    private ValidationTracker tracker;

    void pageAttached()
    {
        check = true;
    }

    Object onValidateForm()
    {
        tracker.recordError("onValidateForm");
        return false;
    }
}

After the first render, page shows the checked checkbox and word "Hello". if
I uncheck the checkbox and press submit, checkbox save you state in
ValidationTracker and after post (in render stage) restore it, but "t:if"
dose not save its state in ValidationTracker and in "render after post"
stage test "check" property from page (and get true). But, in the "post
stage" "t:if" has "false" value, not true. Hence, after form post we see
unchecked checkbox and word "Hello". I think it's wrong.

Yes, I can use @Persist on "check" property, but I need a full page refresh
when pressing F5.

Reply via email to