Today I am trying to figure out how to do validation with TinyMCE editors while using MVC’ s unobtrusive validation. I did a google search and came up with a large number of results that all said the same thing. I couldn’t get any of them to work. While testing I found the following solution. It isn’t perfect but is pretty close to what I need.
Here is the solution I came up with. I didn’t need to add any other additional code to the page.
$('form button[type=submit]').not('.cancel').click(function () {
var form = $('#FormName');
var isValid = form.valid();
var istinymceValid = $('#ContentField').valid();
if (!isValid || !istinymceValid) {
return false;
}
return true;
});