I have a row of buttons, which all create a pdf file which I want to open in a new tab. This way the button page stays on top, and the pdf's open to get printed. To prevent clicking a button twice I disable the button, like this (I use python):
<input type='submit' value='Factureren' name='submitbutton' id='%s'
onclick="javascript:document.getElementById('%s').disabled=true;
document.getElementById('%s').className='button_disabled';"> % ((but_id,) *3)
In FF3 this works fine, i.e. the form is submitted, the script executed and then the button disables. In IE the button just disables, but the form script isn't executed.
Is there a solution to this IE problem?
It is easier to do:
I don't know if this solves your problem but it is what I would do in a case like this. I think you don't need "javascript:" anyway.
You can try using a normal button and triggering the form submit() function in the onclick event:
It is easy: a disabled submit button do not submit a form in IE. Consider to restructure your code:
Instead of controlling the div, why not control the actual submit button? This works universally in all browsers I have tested (IE6+ FF1+ and Safari)
Then on the button all you have to call is
Maybe try to attach the handler to the onsubmit event of the form instead of the click of the button? That would also then work if the user pressed ENTER instead of clicking your button.
onclick="this.disabled='disabled'; this.form.submit();" works perfectly for me