TinyMCE client validation problem

后端 未结 2 910
一个人的身影
一个人的身影 2021-02-05 21:59

I have problem with TinyMCE editor. I have form with few text fields and textarea (tinymce), and enabled client validation. When I click save button validation occures on all te

2条回答
  •  青春惊慌失措
    2021-02-05 22:24

    The reason behind this is that most rich text editors (including tiny mce) doesn't use the text area. Instead it has it's own input and only copies over the text when the form is submitted. So the field you are validating doesn't actually change when you type something in the editor.

    What you will have to do is create a work around for this that copies the text from the editor to the text area when you click the submit button. This can be done like this:

    $('#mySubmitButton').click(function() {
        tinyMCE.triggerSave();
    });
    

提交回复
热议问题