You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ben Tomasini <be...@gmail.com> on 2007/06/29 01:33:20 UTC

T5: form context not invoking onActivate with matching parameters

I was using the following code:

Start.html
<t:form context="literal:test">
    <t:submit />
</t:form>

Start.java

    void onActivate() {
        System.out.println("No args");
    }

    void onActivate(String value) {
        System.out.println("String arg");
    }

On a form submit,  the console shows:

No args

I expected the form tag above to invoke the onActivate method with matching
arguments, it only invokes the noargs method.  Is this a bug, by design, or
am I missing something?

Ben

Re: T5: form context not invoking onActivate with matching parameters

Posted by Ben Tomasini <be...@gmail.com>.
Now that I read the manual I see that all I needed to track the id was this:

    BigDecimal id = null;

    void onActivate(BigDecimal id) {
        this.id = id;
    }

    BigDecimal onPassivate() {
        return id;
    }

Very elegant... Thank you, Tapestry!

Ben


On 6/28/07, Ben Tomasini <be...@gmail.com> wrote:
>
> I was using the following code:
>
> Start.html
> <t:form context="literal:test">
>     <t:submit />
> </t:form>
>
> Start.java
>
>     void onActivate() {
>         System.out.println ("No args");
>     }
>
>     void onActivate(String value) {
>         System.out.println("String arg");
>     }
>
> On a form submit,  the console shows:
>
> No args
>
> I expected the form tag above to invoke the onActivate method with
> matching arguments, it only invokes the noargs method.  Is this a bug, by
> design, or am I missing something?
>
> Ben
>
>
>
>
>

Re: T5: form context not invoking onActivate with matching parameters

Posted by Howard Lewis Ship <hl...@gmail.com>.
There's two different contexts here: the page's activate context
(produced by the "passivate" event, provided to the "activate" event
and the Form component's context, which is provide to event handler
methods related to the Form ("success", "prepare", etc.).

The Form does not fire an "activate" event; the framework fires the
"activate" event, on the page (not the Form), passing the page's
activation context.

On 6/28/07, Ben Tomasini <be...@gmail.com> wrote:
> I was using the following code:
>
> Start.html
> <t:form context="literal:test">
>     <t:submit />
> </t:form>
>
> Start.java
>
>     void onActivate() {
>         System.out.println("No args");
>     }
>
>     void onActivate(String value) {
>         System.out.println("String arg");
>     }
>
> On a form submit,  the console shows:
>
> No args
>
> I expected the form tag above to invoke the onActivate method with matching
> arguments, it only invokes the noargs method.  Is this a bug, by design, or
> am I missing something?
>
> Ben
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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