did you try dojo.event.connect("before", dojo.byId .... ? 2008/10/27 Norman Franke <[EMAIL PROTECTED]>
> I've now upgraded to T4.1.6 and the problem remains on Firefox, IE and > Safari. Here is how I coded it: > > dojo.event.connect(dojo.byId('delete'), 'onclick', > function (evt) { > if (!confirm('Are you sure?')) { > dojo.event.browser.stopEvent(evt); > return false; > } > return true; > } > ) > > No matter what I do, it continues and submits the AJAX action. My "delete" > control is a Tapestry Submit with async=true and an action specified. I > print out stuff from the action, and it is definitely being called. The AJAX > operation happens after I click cancel or OK, so it doesn't appear to > trigger first. And calling a non-function that causes JavaScript to get an > error, does stop. If I make the button async=false, then the onclick works > just fine. > > Norman Franke > Answering Service for Directors, Inc. > www.myasd.com > > On Oct 24, 2008, at 5:30 PM, Norman Franke wrote: > > I did that exact same thing and it did submit. Very strange! I'm using >> Firefox 3.0 and T4.1.5. Where did you put the connect? I tried at the end of >> the body and outsize the body, before the </html> >> >> Norman Franke >> Answering Service for Directors, Inc. >> www.myasd.com >> >> On Oct 24, 2008, at 5:00 PM, Andreas Andreou wrote: >> >> just tried something like >>> dojo.event.connect(dojo.byId('fepSubm'),'onclick', >>> function(e){dojo.event.browser.stopEvent(e);}); >>> and it prevented the submit >>> >>> On Fri, Oct 24, 2008 at 11:29 PM, Norman Franke <[EMAIL PROTECTED]> >>> wrote: >>> >>>> According to the documentation, before is the default. Either way, it >>>> still >>>> doesn't work. The ajax submit is still called. If I call a non-function, >>>> then it doesn't work, e.g. "foobar()". It generates an error in the >>>> console, >>>> but does stop. >>>> >>>> Norman Franke >>>> Answering Service for Directors, Inc. >>>> www.myasd.com >>>> >>>> On Oct 24, 2008, at 4:10 PM, Andreas Andreou wrote: >>>> >>>> sorry - dojo.event.connectBefore is what you need :) >>>>> >>>>> On Fri, Oct 24, 2008 at 11:00 PM, Norman Franke <[EMAIL PROTECTED]> >>>>> wrote: >>>>> >>>>>> >>>>>> I'm using T4.1.5 which has dojo 0.4.x and no dojo. event.stopEvent. I >>>>>> tried >>>>>> dojo.event.browser.stopEvent but that didn't work. Nor did >>>>>> e.stopPropigation >>>>>> or e.preventDefault. In fact, I tried all three together (and >>>>>> separate) >>>>>> and >>>>>> it still fires. >>>>>> >>>>>> Norman Franke >>>>>> Answering Service for Directors, Inc. >>>>>> www.myasd.com >>>>>> >>>>>> On Oct 24, 2008, at 3:31 PM, Andreas Andreou wrote: >>>>>> >>>>>> dojo.event.connect to it and in there do dojo.event.stopEvent (or >>>>>>> something like that) if you >>>>>>> dont want to go on with the submit >>>>>>> >>>>>>> On Fri, Oct 24, 2008 at 10:22 PM, Norman Franke <[EMAIL PROTECTED]> >>>>>>> wrote: >>>>>>> >>>>>>>> >>>>>>>> Thanks. I apparently forgot to look at contrib. >>>>>>>> >>>>>>>> As for the second question, I'd love to, but how can I update the >>>>>>>> formhidden >>>>>>>> section of the form such that my controls (that were created via >>>>>>>> AJAX) >>>>>>>> will >>>>>>>> be sent on the next AJAX action? If I don't update the entire form, >>>>>>>> I >>>>>>>> never >>>>>>>> get the values of the controls, it seems. Changing it from >>>>>>>> @Persist("client") to @Persist("session") seems to have solved it, >>>>>>>> however. >>>>>>>> >>>>>>>> Lastly, how can I get an ajax submit to abort? I want to have an >>>>>>>> onclick >>>>>>>> on >>>>>>>> a the submit that will put up "confirm('Are you sure?')" but no >>>>>>>> matter >>>>>>>> what, >>>>>>>> it submits anyway. >>>>>>>> >>>>>>>> Norman Franke >>>>>>>> Answering Service for Directors, Inc. >>>>>>>> www.myasd.com >>>>>>>> >>>>>>>> On Oct 24, 2008, at 2:36 PM, Andreas Andreou wrote: >>>>>>>> >>>>>>>> To answer your initial question, just use contrib:ajaxStatus from >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> http://tapestry.apache.org/tapestry4.1/tapestry-contrib/componentreference/ajaxstatus.html >>>>>>>>> >>>>>>>>> For the second, why not update only the part in question? >>>>>>>>> >>>>>>>>> On Fri, Oct 24, 2008 at 9:22 PM, Norman Franke <[EMAIL PROTECTED]> >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> >>>>>>>>>> I sort of have it working by doing an "onclick" and relying on the >>>>>>>>>> entire >>>>>>>>>> form to update, which resets my div. >>>>>>>>>> >>>>>>>>>> But that brings up another point. I want to AJAX fetch a list of >>>>>>>>>> elements >>>>>>>>>> with a checkbox. Is there a better way to do this than by setting >>>>>>>>>> the >>>>>>>>>> entire >>>>>>>>>> form as one of the updateComponents? It pretty much forces an >>>>>>>>>> update >>>>>>>>>> of >>>>>>>>>> the >>>>>>>>>> entire page. If I don't, I can't get the values of the checkbox >>>>>>>>>> since >>>>>>>>>> tapestry serializes the state of the @For and checkboxes in >>>>>>>>>> fields. >>>>>>>>>> >>>>>>>>>> What's the best way to handle this? >>>>>>>>>> >>>>>>>>>> Norman Franke >>>>>>>>>> Answering Service for Directors, Inc. >>>>>>>>>> www.myasd.com >>>>>>>>>> >>>>>>>>>> On Oct 24, 2008, at 12:10 PM, Norman Franke wrote: >>>>>>>>>> >>>>>>>>>> I've searched the documentation, and I can't find how one >>>>>>>>>>> implements >>>>>>>>>>> a >>>>>>>>>>> "loading..." indicator when an AJAX request is sent off. My app >>>>>>>>>>> will >>>>>>>>>>> be >>>>>>>>>>> doing a series of database queries which can take 10 seconds or >>>>>>>>>>> so, >>>>>>>>>>> and >>>>>>>>>>> it >>>>>>>>>>> really needs something to tell the user they need to wait a bit. >>>>>>>>>>> Showing/Hiding a div would be great. >>>>>>>>>>> >>>>>>>>>>> Norman Franke >>>>>>>>>>> Answering Service for Directors, Inc. >>>>>>>>>>> www.myasd.com >>>>>>>>>>> >>>>>>>>>>> -- Marcus Schulte http://marcus-schulte.blogspot.com