Does a click on <a> tag inside a jQuery Tools overlay cause a form submit?
More jQuery Tools overlay fun...
I have a "yes/no" jQT modal dialog set up to do simple confirmation, which follows开发者_如何学JAVA the example in http://flowplayer.org/tools/demos/overlay/modal-dialog.html. I've used this in a couple of places on my site, and it's working fine: A click on the "yes" button does a window.location to the href of the "A" tag to which the dialog is attached; a click on "no" just makes the overlay go away.
I'm now using it in another context, attaching it to an "A" tag which is inside a form on the page. The yes/no dialog shows up just like it should, and goes away when a button is clicked on. However, what's driving me crazy is that the form is getting submitted as a result of the click -- I have a onSubmit handler set up on the form to do some validation, and it's firing. If I remove the onSubmit validation handler, the form does the POST specified in the code, but does not do the window.location in the overlay's handler. EXCEPT for Firefox, which, according to my server logs, tries to do both the GET and the POST, leaving me with a page that's rather confused.
The only thing I can figure out is that there's something down inside the bowels of jQuery or jQuery Tools that is generating a form submit, which is triggering my form. Does this make any sense to any one? I'd post some code, but it would take quite awhile to prune it down to the point of being comprehensible by a fresh pair of eyes; I thought I'd try this note on the chance that it triggers a quick "Oh, yeah..." response by somebody out there. Thanks!
I was finally able to get this to work -- I found a way to move the code that creates the dialog's overlay DIV outside the form. I'm still not sure why this works, and what was causing the submit firing from before, but it's working, which is good enough for now...
精彩评论