Unable to get TinyMCE working with jQuery Unobtrusive Validation

后端 未结 5 1379
盖世英雄少女心
盖世英雄少女心 2020-12-04 02:57

I\'ve got a form that\'s using unobtrusive validation and works as expected for all of my fields but once I added TinyMCE (or any other WYSIWYG editor) the textarea it uses

5条回答
  •  难免孤独
    2020-12-04 03:22

    I tried this solution as well as a few other similar ones and was unable to get any of them to work and this is what I came up with instead. It isn't a perfect solution but does the job I needed. I did not 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;
    });
    

提交回复
热议问题