> I have some problem with t:if

I think your problem is really with the redirect-after-post paradigm.

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

Try @Persist("flash"). When you read the value it's removed from the
session until you store it again. This generally solves the problem.
The one place where you might it a snag is if you redirect to a
different page after posting the form. In that case the value will
remain, you can call
ComponentResources#discardPersistentFieldChanges() if you know you're
not going to be redirecting to another page.

Josh

2011/5/15 Василий Жуков <vip.del...@gmail.com>:
> 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.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to