Unable to get TinyMCE working with jQuery Unobtrusive Validation

后端 未结 5 1371
盖世英雄少女心
盖世英雄少女心 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:25

    In my situation: tinyMCE 4, Bootstrap 2.3.1 and jQuery validate 1.9 this is what works:

    $('#form1').data('validator').settings.ignore = '';
    

    Make sure to put that line inside your document ready function. Reason for that is because I have other forms on the same page that need to continue to work with the default: do not validate ':hidden' fields. Check jQuery Validate - Enable validation for hidden fields for a full explanation.

    And the css for bootstrap and the new version of tinyMCE will be something like this:

    .control-group.error .mce-panel {
    border-color: #b94a48;
    -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
    -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
    

    }

提交回复
热议问题