Re: Zones / Forms in a loop - Which iteration invoked the action?

2012-11-26 Thread Geoff Callender
Just for the record, I think you'll find that onPrepare() gets called 
regardless.

In comes an AJAX form submit. The Form may have a context. The Submit may 
specify an event other than SELECT.
- Form bubbles up PREPARE_FOR_SUBMIT. Form context is available if 
specified.
- Form bubbles up PREPARE.
- Submit bubbles up SELECT or the event you specified. In your example I 
think you handle this event and return the zone which stops Form bubbling up 
VALIDATE_FROM_FORM and SUCCESS or FAILURE.
Tapestry switches to rendering the zone content...
- Form bubbles up PREPARE_FOR_RENDER.
- Form bubbles up PREPARE.
Out goes AJAX response with zone content.

On 26/11/2012, at 1:30 AM, Lenny Primak wrote:

> There is another tiny bit that I do that's not like your example that makes 
> all the difference. 
> The button event method updates the zone the form is in, so onPrepare() or 
> any other form methods do not get called. This is why I can't have the 
> context in the form itself, which would Indeed work because the context would 
> be saved in t:formdata element. 
> 
> The event link method works great though and without extra forms. 
> 
> On Nov 24, 2012, at 11:18 PM, Geoff Callender 
>  wrote:
> 
>> On 25/11/2012, at 12:37 PM, Lenny Primak wrote:
>> 
>>> Once again, Geoff, fantastic work on JumpStart!
>> 
>> Thanks Lenny.
>> 
>>> Not quite... 
>>> In the first example, none of the action buttons care in which zone/form 
>>> they are in, they just set the global action variable.
>>> You can readily see the problem if you try to pass a context in the select 
>>> or cancel button, as it will be null.
>> 
>> Sorry, I don't understand the difference. The button event handlers don't 
>> need to carry a context because the Form does it for them.  
>> 
>>   > 
>> When you click Edit, the first event handler invoked is this one:
>> 
>>   void onPrepareForSubmitFromPersonForm(Long personId)
>> 
>> Now we know the context. Then this event handler is invoked:
>> 
>>   void onSelectedFromEdit()
>> 
>> Now we know the action. We're ready to do anything. Then this is invoked:
>> 
>>   void onValidateFromPersonForm()
>> 
>> Doesn't that match your situation?
>> 



Re: Zones / Forms in a loop - Which iteration invoked the action?

2012-11-26 Thread Lenny Primak
Yup.  That'll work too.  Thanks!

On Nov 26, 2012, at 11:03 AM, Norman Franke wrote:

> Generally I include a hidden field inside the form that has the context. It's 
> very easy to implement and use.
> 
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
> 
> 
> 
> On Nov 24, 2012, at 2:31 PM, Lenny Primak wrote:
> 
>> 
>> 
>>   
>>
>>  
>> 
>> 
>> 
>> ... Java
>> 
>> onStart()
>> {
>> // how do I know which one of the start buttons got pushed?
>> // there are n possibilities since there are n loop iterations
>> return zone.getBody();
>> }
>> 
>> 
>> Thanks for your help!
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
> 


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



Re: Zones / Forms in a loop - Which iteration invoked the action?

2012-11-26 Thread Norman Franke
Generally I include a hidden field inside the form that has the context. It's 
very easy to implement and use.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Nov 24, 2012, at 2:31 PM, Lenny Primak wrote:

> 
>  
>
> 
>   
> 
> 
> 
> ... Java
> 
> onStart()
> {
>  // how do I know which one of the start buttons got pushed?
> // there are n possibilities since there are n loop iterations
>  return zone.getBody();
> }
> 
> 
> Thanks for your help!
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 



Re: Zones / Forms in a loop - Which iteration invoked the action?

2012-11-25 Thread Lenny Primak
There is another tiny bit that I do that's not like your example that makes all 
the difference. 
The button event method updates the zone the form is in, so onPrepare() or any 
other form methods do not get called. This is why I can't have the context in 
the form itself, which would Indeed work because the context would be saved in 
t:formdata element. 

The event link method works great though and without extra forms. 

On Nov 24, 2012, at 11:18 PM, Geoff Callender 
 wrote:

> On 25/11/2012, at 12:37 PM, Lenny Primak wrote:
> 
>> Once again, Geoff, fantastic work on JumpStart!
> 
> Thanks Lenny.
> 
>> Not quite... 
>> In the first example, none of the action buttons care in which zone/form 
>> they are in, they just set the global action variable.
>> You can readily see the problem if you try to pass a context in the select 
>> or cancel button, as it will be null.
> 
> Sorry, I don't understand the difference. The button event handlers don't 
> need to carry a context because the Form does it for them.  
> 
> 
> When you click Edit, the first event handler invoked is this one:
> 
>void onPrepareForSubmitFromPersonForm(Long personId)
> 
> Now we know the context. Then this event handler is invoked:
> 
>void onSelectedFromEdit()
> 
> Now we know the action. We're ready to do anything. Then this is invoked:
> 
>void onValidateFromPersonForm()
> 
> Doesn't that match your situation?
> 
>> I actually switched to EventLinks, with buttons inside instead of forms,
>> and it works with them, since the context is saved in the event URL,
>> which matches closely with your second example.
>> 
>> There is a design issue with the first approach.  The only thing that the 
>> Ajax event handler knows
>> is the URL of the request, which is just a page.form.  The nitty gritty lies 
>> in the hidden formdata element,
>> which is where everything is stored.  I think the only way to solve this 
>> problem in my original fashion
>> is to somehow plug into this mechanism to save/restore the context within 
>> the form.
>> 
>> On Nov 24, 2012, at 7:53 PM, Geoff Callender wrote:
>> 
>>> Is your problem different to these?
>>> 
>>>
>>> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formsinaloop
>>>
>>> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/eventlinksinaloop
>>> 
>>> Cheers,
>>> 
>>> Geoff
>>> 
>>> On 25/11/2012, at 7:20 AM, Lenny Primak wrote:
>>> 
 Just tried it, it does not. 
 I think if the submit components themselves are in a loop, that would work,
 but the actual zone and form complex is in a loop itself.
 
 On Nov 24, 2012, at 3:14 PM, Dragan Sahpaski wrote:
 
> Did you try defer="false" ?
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Submit.html
> 
> Cheers,
> Dragan Sahpaski
> 
> 
> 
> On Sat, Nov 24, 2012 at 9:12 PM, Lenny Primak 
> wrote:
> 
>> I tried that way too, but the problem is I can't correlate the button
>> events with the form submission event either.
>> Thanks for your help though
>> 
>> On Nov 24, 2012, at 3:09 PM, Dragan Sahpaski wrote:
>> 
>>> Maybe use the form's context param to differentiate which form got
>>> submitted, and handle onSubmit or onSuccess instead of the submit event?
>>> 
>>> Cheers,
>>> Dragan Sahpaski
>>> 
>>> 
>>> 
>>> On Sat, Nov 24, 2012 at 8:31 PM, Lenny Primak >> wrote:
>>> 
 
 
 
 
 
 
 
 
 ... Java
 
 onStart()
 {
 // how do I know which one of the start buttons got pushed?
 // there are n possibilities since there are n loop iterations
 return zone.getBody();
 }
 
 
 Thanks for your help!
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
>>> 
>>> 
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.

Re: Zones / Forms in a loop - Which iteration invoked the action?

2012-11-24 Thread Geoff Callender
On 25/11/2012, at 12:37 PM, Lenny Primak wrote:

> Once again, Geoff, fantastic work on JumpStart!

Thanks Lenny.

> Not quite... 
> In the first example, none of the action buttons care in which zone/form they 
> are in, they just set the global action variable.
> You can readily see the problem if you try to pass a context in the select or 
> cancel button, as it will be null.

Sorry, I don't understand the difference. The button event handlers don't need 
to carry a context because the Form does it for them.  

 I actually switched to EventLinks, with buttons inside instead of forms,
> and it works with them, since the context is saved in the event URL,
> which matches closely with your second example.
> 
> There is a design issue with the first approach.  The only thing that the 
> Ajax event handler knows
> is the URL of the request, which is just a page.form.  The nitty gritty lies 
> in the hidden formdata element,
> which is where everything is stored.  I think the only way to solve this 
> problem in my original fashion
> is to somehow plug into this mechanism to save/restore the context within the 
> form.
> 
> On Nov 24, 2012, at 7:53 PM, Geoff Callender wrote:
> 
>> Is your problem different to these?
>> 
>>  
>> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formsinaloop
>>  
>> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/eventlinksinaloop
>> 
>> Cheers,
>> 
>> Geoff
>> 
>> On 25/11/2012, at 7:20 AM, Lenny Primak wrote:
>> 
>>> Just tried it, it does not. 
>>> I think if the submit components themselves are in a loop, that would work,
>>> but the actual zone and form complex is in a loop itself.
>>> 
>>> On Nov 24, 2012, at 3:14 PM, Dragan Sahpaski wrote:
>>> 
 Did you try defer="false" ?
 http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Submit.html
 
 Cheers,
 Dragan Sahpaski
 
 
 
 On Sat, Nov 24, 2012 at 9:12 PM, Lenny Primak 
 wrote:
 
> I tried that way too, but the problem is I can't correlate the button
> events with the form submission event either.
> Thanks for your help though
> 
> On Nov 24, 2012, at 3:09 PM, Dragan Sahpaski wrote:
> 
>> Maybe use the form's context param to differentiate which form got
>> submitted, and handle onSubmit or onSuccess instead of the submit event?
>> 
>> Cheers,
>> Dragan Sahpaski
>> 
>> 
>> 
>> On Sat, Nov 24, 2012 at 8:31 PM, Lenny Primak > wrote:
>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> ... Java
>>> 
>>> onStart()
>>> {
>>> // how do I know which one of the start buttons got pushed?
>>> // there are n possibilities since there are n loop iterations
>>> return zone.getBody();
>>> }
>>> 
>>> 
>>> Thanks for your help!
>>> 
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>> 
>>> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 
> 
>>> 
>>> 
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>> 
>> 
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 



Re: Zones / Forms in a loop - Which iteration invoked the action?

2012-11-24 Thread Lenny Primak
Once again, Geoff, fantastic work on JumpStart!

Not quite... 
In the first example, none of the action buttons care in which zone/form they 
are in, they just set the global action variable.
You can readily see the problem if you try to pass a context in the select or 
cancel button, as it will be null.

I actually switched to EventLinks, with buttons inside instead of forms,
and it works with them, since the context is saved in the event URL,
which matches closely with your second example.

There is a design issue with the first approach.  The only thing that the Ajax 
event handler knows
is the URL of the request, which is just a page.form.  The nitty gritty lies in 
the hidden formdata element,
which is where everything is stored.  I think the only way to solve this 
problem in my original fashion
is to somehow plug into this mechanism to save/restore the context within the 
form.

On Nov 24, 2012, at 7:53 PM, Geoff Callender wrote:

> Is your problem different to these?
> 
>   
> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formsinaloop
>   
> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/eventlinksinaloop
> 
> Cheers,
> 
> Geoff
> 
> On 25/11/2012, at 7:20 AM, Lenny Primak wrote:
> 
>> Just tried it, it does not. 
>> I think if the submit components themselves are in a loop, that would work,
>> but the actual zone and form complex is in a loop itself.
>> 
>> On Nov 24, 2012, at 3:14 PM, Dragan Sahpaski wrote:
>> 
>>> Did you try defer="false" ?
>>> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Submit.html
>>> 
>>> Cheers,
>>> Dragan Sahpaski
>>> 
>>> 
>>> 
>>> On Sat, Nov 24, 2012 at 9:12 PM, Lenny Primak wrote:
>>> 
 I tried that way too, but the problem is I can't correlate the button
 events with the form submission event either.
 Thanks for your help though
 
 On Nov 24, 2012, at 3:09 PM, Dragan Sahpaski wrote:
 
> Maybe use the form's context param to differentiate which form got
> submitted, and handle onSubmit or onSuccess instead of the submit event?
> 
> Cheers,
> Dragan Sahpaski
> 
> 
> 
> On Sat, Nov 24, 2012 at 8:31 PM, Lenny Primak  wrote:
> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> ... Java
>> 
>> onStart()
>> {
>> // how do I know which one of the start buttons got pushed?
>> // there are n possibilities since there are n loop iterations
>> return zone.getBody();
>> }
>> 
>> 
>> Thanks for your help!
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
>> 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
>> 
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 


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



Re: Zones / Forms in a loop - Which iteration invoked the action?

2012-11-24 Thread Geoff Callender
Is your problem different to these?


http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formsinaloop

http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/eventlinksinaloop

Cheers,

Geoff

On 25/11/2012, at 7:20 AM, Lenny Primak wrote:

> Just tried it, it does not. 
> I think if the submit components themselves are in a loop, that would work,
> but the actual zone and form complex is in a loop itself.
> 
> On Nov 24, 2012, at 3:14 PM, Dragan Sahpaski wrote:
> 
>> Did you try defer="false" ?
>> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Submit.html
>> 
>> Cheers,
>> Dragan Sahpaski
>> 
>> 
>> 
>> On Sat, Nov 24, 2012 at 9:12 PM, Lenny Primak wrote:
>> 
>>> I tried that way too, but the problem is I can't correlate the button
>>> events with the form submission event either.
>>> Thanks for your help though
>>> 
>>> On Nov 24, 2012, at 3:09 PM, Dragan Sahpaski wrote:
>>> 
 Maybe use the form's context param to differentiate which form got
 submitted, and handle onSubmit or onSuccess instead of the submit event?
 
 Cheers,
 Dragan Sahpaski
 
 
 
 On Sat, Nov 24, 2012 at 8:31 PM, Lenny Primak >>> wrote:
 
> 
> 
>  
>  
> 
> 
> 
> 
> ... Java
> 
> onStart()
> {
> // how do I know which one of the start buttons got pushed?
> // there are n possibilities since there are n loop iterations
> return zone.getBody();
> }
> 
> 
> Thanks for your help!
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 
> 
>>> 
>>> 
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>> 
>>> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 


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



Re: Zones / Forms in a loop - Which iteration invoked the action?

2012-11-24 Thread Lenny Primak
Just tried it, it does not. 
I think if the submit components themselves are in a loop, that would work,
but the actual zone and form complex is in a loop itself.

On Nov 24, 2012, at 3:14 PM, Dragan Sahpaski wrote:

> Did you try defer="false" ?
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Submit.html
> 
> Cheers,
> Dragan Sahpaski
> 
> 
> 
> On Sat, Nov 24, 2012 at 9:12 PM, Lenny Primak wrote:
> 
>> I tried that way too, but the problem is I can't correlate the button
>> events with the form submission event either.
>> Thanks for your help though
>> 
>> On Nov 24, 2012, at 3:09 PM, Dragan Sahpaski wrote:
>> 
>>> Maybe use the form's context param to differentiate which form got
>>> submitted, and handle onSubmit or onSuccess instead of the submit event?
>>> 
>>> Cheers,
>>> Dragan Sahpaski
>>> 
>>> 
>>> 
>>> On Sat, Nov 24, 2012 at 8:31 PM, Lenny Primak >> wrote:
>>> 
 
 
   
   
  
 
 
 
 ... Java
 
 onStart()
 {
 // how do I know which one of the start buttons got pushed?
 // there are n possibilities since there are n loop iterations
 return zone.getBody();
 }
 
 
 Thanks for your help!
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
>> 
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
>> 


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



Re: Zones / Forms in a loop - Which iteration invoked the action?

2012-11-24 Thread Dragan Sahpaski
Did you try defer="false" ?
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Submit.html

Cheers,
Dragan Sahpaski



On Sat, Nov 24, 2012 at 9:12 PM, Lenny Primak wrote:

> I tried that way too, but the problem is I can't correlate the button
> events with the form submission event either.
> Thanks for your help though
>
> On Nov 24, 2012, at 3:09 PM, Dragan Sahpaski wrote:
>
> > Maybe use the form's context param to differentiate which form got
> > submitted, and handle onSubmit or onSuccess instead of the submit event?
> >
> > Cheers,
> > Dragan Sahpaski
> >
> >
> >
> > On Sat, Nov 24, 2012 at 8:31 PM, Lenny Primak  >wrote:
> >
> >> 
> >>  
> >>
> >>
> >>   
> >> 
> >> 
> >>
> >> ... Java
> >>
> >> onStart()
> >> {
> >>  // how do I know which one of the start buttons got pushed?
> >> // there are n possibilities since there are n loop iterations
> >>  return zone.getBody();
> >> }
> >>
> >>
> >> Thanks for your help!
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>
> >>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Zones / Forms in a loop - Which iteration invoked the action?

2012-11-24 Thread Lenny Primak
I tried that way too, but the problem is I can't correlate the button events 
with the form submission event either.
Thanks for your help though

On Nov 24, 2012, at 3:09 PM, Dragan Sahpaski wrote:

> Maybe use the form's context param to differentiate which form got
> submitted, and handle onSubmit or onSuccess instead of the submit event?
> 
> Cheers,
> Dragan Sahpaski
> 
> 
> 
> On Sat, Nov 24, 2012 at 8:31 PM, Lenny Primak wrote:
> 
>> 
>>  
>>
>>
>>   
>> 
>> 
>> 
>> ... Java
>> 
>> onStart()
>> {
>>  // how do I know which one of the start buttons got pushed?
>> // there are n possibilities since there are n loop iterations
>>  return zone.getBody();
>> }
>> 
>> 
>> Thanks for your help!
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
>> 


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



Re: Zones / Forms in a loop - Which iteration invoked the action?

2012-11-24 Thread Dragan Sahpaski
Maybe use the form's context param to differentiate which form got
submitted, and handle onSubmit or onSuccess instead of the submit event?

Cheers,
Dragan Sahpaski



On Sat, Nov 24, 2012 at 8:31 PM, Lenny Primak wrote:

> 
>   
> 
> 
>
>  
> 
>
> ... Java
>
> onStart()
> {
>   // how do I know which one of the start buttons got pushed?
>  // there are n possibilities since there are n loop iterations
>   return zone.getBody();
> }
>
>
> Thanks for your help!
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Zones / Forms in a loop - Which iteration invoked the action?

2012-11-24 Thread Lenny Primak

  

 
   
 


... Java

onStart()
{
  // how do I know which one of the start buttons got pushed?
 // there are n possibilities since there are n loop iterations
  return zone.getBody();
}


Thanks for your help!

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