I have the following code which does the form submission and everything works well, until i have a textarea with tinymce attached to it, it does not send any data to the server, not sure what is wrong
ig i use normal textarea the data is sent and saved in the database, but only seems to be a trouble with the editor based textarea
var formSubmission = document.getElementById('formSubmission');
if(formSubmission) {
$("#formSubmission").validate({
errorPlacement: function(error, element) {
error.appendTo(element.parent());
},
highlight: function(element) {
$(element).addClass("error");
},
unhighlight: function(element) {
$(element).removeClass("error");
},
submitHandler: function(form) {
var $form = $(form),
formData = new FormData(),
params = $form.serializeArray();
var filesInput = $form.find('[name="uploadfile"]');
if (filesInput.length > 0 && filesInput[0].files.length > 0) {
var files = filesInput[0].files;
$.each(files, function(i, file) {
formData.append('uploadedFiles', file);
});
}
$.each(params, function(i, val) {
formData.append(val.name, val.value);
});
// Block UI and show processing message
$.blockUI({
message: '<h3>Please wait, we are running some background processes to make it work...</h3>',
css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
color: '#fff'
}
});
$.ajax({
url:'process.cfm?action=' + $('#formSubmission').attr('data-post'),
data: formData,
mimeType: "multipart/form-data",
contentType: false,
processData: false,
type:'POST',
dataType: 'json',
success: function(data) {
// Unblock UI
$.unblockUI();
var json = data;
if((json.SUCCESS === true) || (json.valid === true) || (json.sucess === true)) {
showAlert(json.message, 'success', 1);
} else {
showAlert(json.message, 'error');
}
},
error: function(textStatus, errorThrown) {
// Unblock UI
$.unblockUI();
showAlert('An error occurred during the operation: ' + textStatus, 'error');
}
});
return false;
}
});
}