![]() |
Show/hide DIV only working in Firefox
Hello,
I have the HTML / Javascript code below to show a loading GIF when a form is submitted (using the onsubmit function). The code is only working in Firefox but no other browsers and I can't figure out what I've got wrong. Thank you for any help!! Code:
<div id="errorModal" class="modal"> |
Shouldn't really be working in FF.
When you call a <form>s submit() function, you *BYPASS* the onsubmit! I suppose it is working in FF because you have TWO bugs. You are *BOTH* calling the <form>'s onsubmit() function *AND* you are *NOT* suppressing the action of the submit button. So FF ends up submitting the form *TWICE*. It's an easy fix: Code:
<input type="submit" name="okButton" id="okButton" class="shortButton" value="OK" Notice also how you can shorten your code that disables the form fields. |
Thank you so much for the help! I've modified the code but now the form doesn't submit. Do I need to add the document.modalConfirm.submit() to the onsubmit function?
Thank you!! |
No, read what I wrote.
The return true should be enough. Only thing I can think of is that there is a problem in the code to show the overlay, though I dunno what it would be. Best I could suggest is SIMPLIFY. Get rid of onsubmit="$('#loaderDiv').show();" from the <form> tag.And then modify the submit button to this: Code:
<input type="submit" name="okButton" id="okButton" class="shortButton" value="OK" Hmmm...actually, that might be part of the problem. Instead of action="#" try using just action="" ??? |
When you submit a form, the page is dismissed, so you can't be certain of getting any kind of screen updating before it happens. The only way is to allow time for the screen update by delaying the sending of the form, ensuring that it degrades if script isn't available:
Code:
<!doctype html> |
Thank you again for the help! So I modified the code to reflect the below and this time the div is being unhidden but the form isn't actually being submitted. I've tried modifying the action to #, "" and an actual page but nothing. Here is the code as it stands now:
Code:
<div id="errorModal" class="modal">Quote:
|
Mystifies me. There is certainly nothing in that code that should be preventing the submit.
Can you give us a live URL to look at? |
| All times are GMT +1. The time now is 02:26 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.