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 
> <geoff.callender.jumpst...@gmail.com> 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.  
>> 
>>   <form t:id="personForm" t:type="form" t:context="person.id" ...
>> 
>> 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?
>> 

Reply via email to