Re: T5: LinkSubmit should be generic
Sorry for spamming multiple threads, just thought this was important: It is very easy to provide both a context parameter and the input element value as context. I did the latter, se my updated blog post: http://tinybits.blogspot.com/2010/05/mixin-to-allow-any-element-to-submit.html On Fri, May 28, 2010 at 2:39 PM, paha wrote: > > very strange. well i never used LinkSubmit. but as i said, the code works > as > expected (at least from my point of view :) ) only if you change the if > statement. "as is" the form never gets submitted. i know almost nothing > about js, and very little about t5. perhaps my code won't work in some > complex scenario and vice-versa, this code doesn't work in simple case :) > -- > View this message in context: > http://old.nabble.com/T5%3A-LinkSubmit-should-be-generic-tp28630552p28706385.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 > >
Re: T5: LinkSubmit should be generic
very strange. well i never used LinkSubmit. but as i said, the code works as expected (at least from my point of view :) ) only if you change the if statement. "as is" the form never gets submitted. i know almost nothing about js, and very little about t5. perhaps my code won't work in some complex scenario and vice-versa, this code doesn't work in simple case :) -- View this message in context: http://old.nabble.com/T5%3A-LinkSubmit-should-be-generic-tp28630552p28706385.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
Re: T5: LinkSubmit should be generic
Don't know, I only copied the code from LinkSubmit and did some very minor changes, not including the stuff you're listing here :) On Fri, May 28, 2010 at 2:09 PM, paha wrote: > > Hi Inge, > > tried you code today. doesn't seem to work. maybe i'm using it incorrectly. > i have following template > > > > > > > > t:mixins="anySubmit" t:event="selected" > > t:clientEvent="change"/> > > > > > > > > > this part in if > if (onsubmit == undefined || onsubmit.call(window.document, event)) >{ >this.createHidden(); >this.form.submit(); >} > never gets called because onsubmit.call(window.document, event) == > undefined > and the form is never submitted. but if you change to > if (onsubmit == undefined || onsubmit.call(window.document, event) == > undefined) > everything works as expected. > > is it a bug, or i just don't get how this mixin was supposed to work? > -- > View this message in context: > http://old.nabble.com/T5%3A-LinkSubmit-should-be-generic-tp28630552p28706046.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 > >
Re: T5: LinkSubmit should be generic
Hi Inge, tried you code today. doesn't seem to work. maybe i'm using it incorrectly. i have following template > >t:mixins="anySubmit" t:event="selected" > t:clientEvent="change"/> > > > this part in if if (onsubmit == undefined || onsubmit.call(window.document, event)) { this.createHidden(); this.form.submit(); } never gets called because onsubmit.call(window.document, event) == undefined and the form is never submitted. but if you change to if (onsubmit == undefined || onsubmit.call(window.document, event) == undefined) everything works as expected. is it a bug, or i just don't get how this mixin was supposed to work? -- View this message in context: http://old.nabble.com/T5%3A-LinkSubmit-should-be-generic-tp28630552p28706046.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
Re: T5: LinkSubmit should be generic
https://issues.apache.org/jira/browse/TAP5-1167 On Fri, May 21, 2010 at 4:07 PM, Thiago H. de Paula Figueiredo < thiag...@gmail.com> wrote: > On Fri, 21 May 2010 10:55:17 -0300, Bryan Lewis > wrote: > > Cool. It reminds me of a question I've been meaning to ask. >> > > LinkSubmit is a component, but we could have a mixin like Inge suggested. > :) > > > What's the best way to define the default value for component parameters? >> Is it: >> >>@Parameter(defaultPrefix = BindingConstants.LITERAL) >>private String clientEvent = "change"; >> >> or: >> >>@Parameter(value = "change", defaultPrefix = BindingConstants.LITERAL) >>private String clientEvent; >> >> or some method with a name starting with "default"? I think I've seen all >> three usages. >> > > If the default is constant, I use @Parameter(value = "change"). If not, I > use a defaultXXX() method. > > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, > and instructor > Owner, Ars Machina Tecnologia da Informação Ltda. > http://www.arsmachina.com.br > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: T5: LinkSubmit should be generic
On Fri, 21 May 2010 10:55:17 -0300, Bryan Lewis wrote: Cool. It reminds me of a question I've been meaning to ask. LinkSubmit is a component, but we could have a mixin like Inge suggested. :) What's the best way to define the default value for component parameters? Is it: @Parameter(defaultPrefix = BindingConstants.LITERAL) private String clientEvent = "change"; or: @Parameter(value = "change", defaultPrefix = BindingConstants.LITERAL) private String clientEvent; or some method with a name starting with "default"? I think I've seen all three usages. If the default is constant, I use @Parameter(value = "change"). If not, I use a defaultXXX() method. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: LinkSubmit should be generic
Cool. It reminds me of a question I've been meaning to ask. What's the best way to define the default value for component parameters? Is it: @Parameter(defaultPrefix = BindingConstants.LITERAL) private String clientEvent = "change"; or: @Parameter(value = "change", defaultPrefix = BindingConstants.LITERAL) private String clientEvent; or some method with a name starting with "default"? I think I've seen all three usages. On Fri, May 21, 2010 at 6:32 AM, Inge Solvoll wrote: > You're right, it was the blog tool that stripped it off :) Fixed now. > > On Fri, May 21, 2010 at 12:07 PM, paha wrote: > > > > > there is a small compilation issue - ProcessSubmission should inherit > from > > ComponentAction, not from ComponentAction, shouldn't it? > > > > > > -- > > View this message in context: > > > http://old.nabble.com/T5%3A-LinkSubmit-should-be-generic-tp28630552p28631907.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 > > > > >
Re: T5: LinkSubmit should be generic
You're right, it was the blog tool that stripped it off :) Fixed now. On Fri, May 21, 2010 at 12:07 PM, paha wrote: > > there is a small compilation issue - ProcessSubmission should inherit from > ComponentAction, not from ComponentAction, shouldn't it? > > > -- > View this message in context: > http://old.nabble.com/T5%3A-LinkSubmit-should-be-generic-tp28630552p28631907.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 > >
Re: T5: LinkSubmit should be generic
there is a small compilation issue - ProcessSubmission should inherit from ComponentAction, not from ComponentAction, shouldn't it? -- View this message in context: http://old.nabble.com/T5%3A-LinkSubmit-should-be-generic-tp28630552p28631907.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
Re: T5: LinkSubmit should be generic
Nice! - Original Message - From: "Inge Solvoll" To: "Tapestry users" Sent: Friday, 21 May, 2010 11:34:11 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: T5: LinkSubmit should be generic Forget the question, I tested it myself and it works :) See the blog post for the complete working solution, that enables any element to submit the form and trigger an event, like a regular submit. http://tinybits.blogspot.com/2010/05/mixin-to-allow-any-element-to-submit.html On Fri, May 21, 2010 at 9:29 AM, Inge Solvoll wrote: > After looking at the source code for the LinkSubmit core component, I see a > lot of potential for a more generic component/mixin that could solve lots of > other problems. > > What I need right now (and quite often) is a Select component that submits > the form and triggers an event to let the component class know that it was > the source of the submit. The LinkSubmit source code is very close to doing > this, the only difference is that it insists on rendering a link. > > My questions is: > > Is it possible to encapsulate this in a mixin, named something like > "AnySubmit"? It would only need parameters for "event" and "clientEvent". > > I tried, but I don't see how I can use a mixin and still trigger an event > on submit using ComponentAction. See modified code from LinkSubmit below, is > this possible to do in a mixin on any component? > > private static class ProcessSubmission implements > ComponentAction { > > private final String clientId; > > public ProcessSubmission(String clientId) { > this.clientId = clientId; > } > > public void execute(MySubmitMixinClass component) { > component.processSubmission(clientId); > } > } > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: LinkSubmit should be generic
Forget the question, I tested it myself and it works :) See the blog post for the complete working solution, that enables any element to submit the form and trigger an event, like a regular submit. http://tinybits.blogspot.com/2010/05/mixin-to-allow-any-element-to-submit.html On Fri, May 21, 2010 at 9:29 AM, Inge Solvoll wrote: > After looking at the source code for the LinkSubmit core component, I see a > lot of potential for a more generic component/mixin that could solve lots of > other problems. > > What I need right now (and quite often) is a Select component that submits > the form and triggers an event to let the component class know that it was > the source of the submit. The LinkSubmit source code is very close to doing > this, the only difference is that it insists on rendering a link. > > My questions is: > > Is it possible to encapsulate this in a mixin, named something like > "AnySubmit"? It would only need parameters for "event" and "clientEvent". > > I tried, but I don't see how I can use a mixin and still trigger an event > on submit using ComponentAction. See modified code from LinkSubmit below, is > this possible to do in a mixin on any component? > > private static class ProcessSubmission implements > ComponentAction { > > private final String clientId; > > public ProcessSubmission(String clientId) { > this.clientId = clientId; > } > > public void execute(MySubmitMixinClass component) { > component.processSubmission(clientId); > } > } >
Re: T5 LinkSubmit?
Not yet; I don't think there's an issue to track this yet, adding one would be most helpful. On 4/25/07, Tim Sawyer <[EMAIL PROTECTED]> wrote: Is there any equivalent in T5 of LinkSubmit? Ta, Tim. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- 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