I have some questions about linksubmit/submit in a loop. I have some enums {e1, e2, e3} for example. In the loop I generate a linksubmit for each enum and pass the enum in the linksubmit context parameter and an event called "handleEnum" in the event parameter. From what I understand, theoretically this linksubmit should generate a call to my "handleEnum" event handler so I can set some properties and then later the onSuccess event handler method should be invoked and .
However 3 things happened that I didn't expect: 1) The context expression "oneEnum" always evaluated to the last value of the loop (e3) and only my ha ndleEnum method was called. When I converted the LinkSubmit to a EventLink, this worked fine. 2) my onSuccess method was never called. When I moved the onSuccess method form the component to the page where the form was defined, it was called. 3) I noticed that in my onSuccess method, the parameter "handler" was null. On a submit, when are parameters re-bound? In Tapestry4, after a form submission, the rewind was rebuilt from the encoded form state and all components had their params rebound with the correct values and I was able to access my parameters in my form submit listener methods. I am still learning tapestry 5 but can anyone explain these behaviors and perhaps suggest a better method of getting what I want accomplished? I pasted the relevant code below. The code is based on: http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html inside a component I have: <ul> <t:loop source="someEnums" value="oneEnum"> <li> name of oneEnum </li> </t:loop> </ul> and: public enum MyEnum {e1, e2, e3} @Parameter private Handler handler; @Property private MyEnum oneEnum; @Property private MyEnum selectedEnum; public MyEnum[] getSomeEnums() {return MyEnum.values();} @SuppressWarnings("unused") @Component(parameters = {"event=enumHandle", "context=oneEnum"}) private LinkSubmit linkEnum; @OnEvent(value = "enumHandle") void handleEnumClick(String oneEnum) //oneEnum is always e3 { selectedEnum = MyEnum.valueof(oneEnum); } Object onSuccess() //is not called unless I move to page class { handler.handle(selectedEnum); //the handler parameter is null return null; } -- View this message in context: http://tapestry.1045711.n5.nabble.com/LinkSubmit-in-a-loop-tp4742981p4742981.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org