:) It's all about understanding the component model and how form
components interact during a post. I'd recommend reading the source of
the submit/textfield/form components it's not that long and could
provide some light as to what's going on. Using the debugger and
walking through is also very illuminating.

I've been through that process so let me lay out some of what I've learned here:

If you look in the submit code you'll see this in the beginRender method:
        formSupport.store(this, new ProcessSubmission(clientId, name));

This actually sticks a representation in the t:formdata to be
processed during a submit. These are put in to formdata in document
order, and processed in document order. All of the form fields do the
same thing, they stick an object in t:formdata that is processed when
the form is submitted.

If you put a submit button at the top of the form then it's processed
first, if you put it at the bottom of a form it's processed last. This
is where defer comes in. If you want your selected event to come after
all the rest of the form has been processed you need to set defer to
true.

During process submission:

        if (defer)
            formSupport.defer(sendNotification);
        else
            heartbeat.defer(sendNotification);

The heartbeat in this case is owned by the loop and is executed at the
end of each iteration in the loop (also stored in the t:formdata). If
you're not in a loop this isn't true, the heartbeat is actually
executed right after the stored actions are executed, and the deferred
action right after that:

            resources.triggerContextEvent(EventConstants.PREPARE,
context, eventCallback);

            if (eventCallback.isAborted())
                return true;

            executeStoredActions();

            heartbeat.end();

            formSupport.executeDeferred();


so defer really has no effect.

Hopefully that's helpful.

Josh

On Fri, Oct 28, 2011 at 6:01 PM, George Christman
<gchrist...@cardaddy.com> wrote:
> Josh, I did some more experimenting and come up with the following outcome.
>
> I have two sets of buttons on the page, one set at the top of the page and
> once set at the bottom of the page. They are both identical other than the
> generated id's created by tapestry. The first set of buttons at the top of
> the page does not call the tapestry methods in the proper sequence. The
> second set at the bottom of the page seem to work perfectly fine. Is this
> possible a bug or something I'm doing wrong?
>
> Script generated
>
> Tapestry.init({
> 4 "linkSubmit" : [
> 5 {
> 6 "form" : "PR",
> 7 "validate" : true,
> 8 "clientId" : "linksubmit"
> 9 },
> 10 {
> 11 "form" : "PR",
> 12 "validate" : true,
> 13 "clientId" : "linksubmit_0"
> 14 },
> 15 {
> 16 "form" : "PR",
> 17 "validate" : true,
> 18 "clientId" : "linksubmit_1"
> 19 },
> 20 {
> 21 "form" : "PR",
> 22 "validate" : true,
> 23 "clientId" : "linksubmit_2"
> 24 }
> 25 ],
> 26 "formEventManager" : [
> 27 {
> 28 "formId" : "PR",
> 29 "validate" : {
> 30 "submit" : false,
> 31 "blur" : false
> 32 }
> 33 }
> 34 ]
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Submit-inside-loop-tp4946513p4946808.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
>
>

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

Reply via email to