On 01/26/2011 07:32 PM, Josh Canfield wrote:
On my local machine, it runs as expected. I take in parameters from a TML
declaration of the mixin on a Submit button. I have it bind via Prototype to
the mouseup event to fire a method that returns via AJAX back to the Page
class.
I just re-read your original post. Are you canceling the form submit
when you handle the mouseup?
Ah, no, that seems like the exceedingly logical thing to do though. I had basically set it so the mixin would set the Page variable, so although the form always submitted, it had a line of logic to read the page variable and know when to stop itself and return out before processing DB entities and such.

I inserted some simple JS after the ZoneManager call that wastes half a
second of time. That seemed to be ample time to allow the ZoneManager update
to trigger the event before the form submission. Do you think 500 ms is
excessive waiting time here?
I'm not sure how you're code works, but instead I'd fix the issue by
preventing the form from being submitted when you capture the mouseup,
and then do the re-post the form in Javascript when you know it's what
needs to get done. Putting in pauses is the kind of workaround that's
likely to bite you later when the timing changes again.

I seem to recall something like this coming up on the list before,
there might be existing code for an ajax enabled confirmation dialog.
A quick google didn't find it, but you might have more luck if you're
more persistent.

Josh

Gotcha. I do like the sound of that solution better, albeit it is more complicated (in terms of what I know how to do and don't know how to do). I'm a bit lost as to what I'd need to do to make this happen. I suppose it won't require a ZoneManager update for one thing, since this solution avoids interacting back with the server. Is there a way to hook up the mixin to the Submit so that it can return false for the onsubmit event of the Submit element? That seems like probably the most straightforward solution I can think of to stop the form, unless there's a Tapestry way of canceling the event that calls back to the Page class onPrepare/onSuccess methods.

I found this thread ( http://tapestry.1045711.n5.nabble.com/quot-Confirm-quot-mixin-won-t-cancel-when-in-zone-td2436465.html ) which seems similar, but wasn't quite able to parse out the necessary javascript concepts I'd need to get what I'm looking for. Furthermore, that code is for an EventLink, I've got a Submit element, and that thread seemed to make reference to a distinct differentiation between the two scenarios. Also looks like I was asking about this months ago heh ( http://tapestry.markmail.org/search/?q=cancel%20form%20submission#query:cancel%20form%20submission%20order%3Adate-backward+page:2+mid:wi2l27jeaezsaoo3+state:results ) but I guess I never really figured out the problem at hand back then.

Thanks,
Rich

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

Reply via email to