johlwiler Posted September 7, 2007 Share Posted September 7, 2007 Hey all I have what I thought was a basic javascript function that disables the submit button of my form and shows a div that is set to display none by flipping it to block. Here is the function as I have it defined in the header <script language="javascript" type="text/javascript"> function process(){ if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById("showAfteClick").style.display = 'block'; document.getElementById("fsubmit").disabled=true; } else { if (document.layers) { // Netscape 4 document.showAfteClick.display = 'block'; document.creditform.fsubmit.disabled=true; } else { // IE 4 document.all.showAfteClick.style.display = 'block'; } } } </script> the id of the form that the submit button resides in is creditform and the id of the submit button its self is submitf The div is after the form and has the id of showAfteClick. Here is how I call the function <input name='submit' type='submit' value='Submit' id="fsubmit" onclick="process()" /> In Firefox when I click the button the button disables and the div shows. And it post to the next page In IE 7 (I don't have 6 anymore so I don't know if same issue, but this script has worked on 6 before) the button disables and the dive shows but the form never post. I even tryed getting as simple as getting rid of the div and on the button going onclick="this.disabled=true;" and that didn't work either. I guess my question should be, is IE 7 introducing a new DOM or something. is there a work around for this. I need this submit button to work and if people click it twice there will be huge problems. Plus it takes a while to post because a lot is happening so I was going to put like an animated gif in the div so people would think it is loading. and in firefox it does. IE does not. Quote Link to comment Share on other sites More sharing options...
micah1701 Posted September 7, 2007 Share Posted September 7, 2007 it looks like IE7 is not submitting the form because you've disabled the submit button. i know, that sounds dumb but i tested your code and when i took out the line that disables the submit button, it worked fine. maybe instead of disabling the Submit button, you could just hide it at the same time you're un-hiding the other block? Quote Link to comment Share on other sites More sharing options...
emehrkay Posted September 7, 2007 Share Posted September 7, 2007 well since you're disabling the submit button, you still need to submit the form. do document.getElementById('formid').submit(); in your function Quote Link to comment Share on other sites More sharing options...
sneamia Posted September 7, 2007 Share Posted September 7, 2007 I also suggest http://tredosoft.com/Multiple_IE. Quote Link to comment Share on other sites More sharing options...
johlwiler Posted September 8, 2007 Author Share Posted September 8, 2007 I tryed the well since you're disabling the submit button, you still need to submit the form. do document.getElementById('formid').submit(); in your function And in IE 7 it did submit but nothing else worked. I took ou all of the legacy code. I am going to try it with what micah1707 said and just hide it. Hree is my current code <script language="javascript" type="text/javascript"> function process(){ document.getElementById("showAfteClick").style.display = 'block'; document.getElementById("fsubmit").disabled=true; document.getElementById('creditform').submit(); } </script> When I added the submit it was almost like it over rode everything else. Quote Link to comment Share on other sites More sharing options...
johlwiler Posted September 9, 2007 Author Share Posted September 9, 2007 ok thanks for your help guys. this works. it hides the button and shows the div. function process(){ document.getElementById('showAfterClick').style.display = 'block'; document.getElementById('fsubmit').style.display='none'; document.getElementById('creditform').submit(); } </script> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.