Mahmoud Saleh
Mahmoud Saleh

Reputation: 33605

Form doesn't submit in chrome if form submit button is disabled onclick

I am using YUI3 rich text editor and onclick of the submit button the editor saves the changes then the button is disabled

window.myEditor = new YAHOO.widget.SimpleEditor('textarea', myConfig);
    myEditor.render();
    YAHOO.util.Event.on('submitButton', 'click', function() {
        myEditor.saveHTML();
        document.getElementById('submitButton').disabled=true;
    });

in firefox everything works fine, editor applies the changes, then the button is disabled then form submits, but in chrome, only the button is disabled and nothing happens any ideas ?

note: button type is submit.

Upvotes: 2

Views: 2079

Answers (2)

Mahmoud Saleh
Mahmoud Saleh

Reputation: 33605

it worked fine after disabling the button then saving the html:

window.myEditor = new YAHOO.widget.SimpleEditor('textarea', myConfig);
    myEditor.render();
    YAHOO.util.Event.on('submitButton', 'click', function() {
       document.getElementById('submitButton').disabled=true; 
       myEditor.saveHTML();      
    });

Upvotes: 0

mplungjan
mplungjan

Reputation: 177786

try

YAHOO.util.Event.on('submitButton', 'click', function() {
  myEditor.saveHTML();
  setTimeout(function() {
   document.getElementById('submitButton').disabled=true;
  }, 300);
});

Upvotes: 1

Related Questions