I have jQuery UI Popup dialog form, which has a TinyMce editor. It is working well with Google Chrome and Internet Explorer8+.
But in Firefox(Firefox20), when I edit/change the content in the TinyMCE editor and while clicking the submit button, the page gets focussed on the TinyMCE editor for the first time. And in the second time it gets submitted.
And I am using
jQuery validation plugin for the form validation ( in
http://jqueryvalidation.org/). And the my code is as follows (This works perfect in IE8+ and Google Chrome):
//form submit function and the form validationjQuery('#frm').submit(function() {
// update underlying textarea before submit validation
tinyMCE.triggerSave(true,true);
}).validate({
errorClass: 'error',
rules: {
//validation rules
'users':'required'
},
submitHandler: function(form) {
//submit confirmatiom
if (confirm('Are you sure you want to submit the form?' ){
$('#frm').ajaxSubmit({
beforeSubmit: beforeFormSubmit, // pre-submit callback
success: afterSubmit // post submit callback
});
return false;
}
}
});
//pre-submit callbackfunction beforeFormSubmit(){
$('#btn_submit').val("Saving...");
$.blockUI(); //block ui plugin
}
//post submit callbackfunction afterSubmit(response, status) {
if(status == 'success') {
$('#message_box').html("Success.")
}else{
$('#message_box').html("Error : "+response)
}
$.unblockUI();
}
------------------------------------------------------------------------------------------------