I have that situation:
<form class="reqSnip" action="snipvw" method="post" target="_blank">
<input type="hidden" name="a_snip" value="0">
<input type="hidden" name="b_snip" value="1">
<input type="hidden" name="fullDoc" value="true">
<button type="submit" class="getFullSnippet"></button>
</form>
So - basic form with 3 hidden field+button to submit. With the help of jQuery I bind to the moment of submit this form and customize the process:
jQuery('.reqSnip').submit(function() {
jQuery('#snipDIV').jqmShow(); // 1
return false; // 2
});
To make picture clear:
- // 1 - open some "pop-up-like" window over Web-page
- // 2 - cancel form submit. I do so since the form just request some Ajax-info and must NOT perform standart form submission. For my question you can think as I just don't want the form submission take place, all Ajax-stuff is irrelevant for the question.
How all this works together:
- In IE7/8/9/Chrome/Opera - all as expected, pop-up open, form don't submitted
- In FireFox(ver. 8.0.1 on Windows XP SP3) - pop-up open and from DO submitted (so new tab appear in browser)
I make a light investigation in javascript debuggers (I just place 2 breakpoints(BP) on lines // 1 and // 2) and facts I discover:
- IE7/8/9/Chrome/Opera - hit BP on line // 1, then BP on line // 2
- FireFox - hit BP on line // 1 and NEVER hit BP on line // 2, so command 'return false' just never executed :(
So - how to make FF behaviour the same as in all others browsers?
P.S. Libraries used in line 1:
- jQuery - you know it :)
- jqmShow - command from jqModal, this is a plugin for jQuery. It's home page: http://dev.iceburg.net/jquery/jqModal
UPDATE
I found root of the problem... According jqModal documentation (see link above) if you bind to onShow event you must to show (set visible) the dialog (my "pop-up-like" window) inside the event handler. So the general scheme will be
var myOpen=function(hash){ hash.w.css('opacity',0.88).show(); };
$('#dialog').jqm({onShow:myOpen});
....
$('#dialog').jqmShow();
I wrote my code very close to this. All browsers accept this approach. FF "dislike" it. Have no idea why. So, to solve my problem it is enough DON'T bind to onShow event. That is!