1

Closed

CKEditor hidden after form validated false

description

After i submit my form has validatecontrol, the CKEditor is destroyed (hidden). how i can re-show CKEditor after it hide?
Closed Mar 30 at 1:22 PM by tha_watcha
No answer

comments

tha_watcha wrote Mar 11, 2016 at 8:22 PM

What module do you use?

thienvc wrote Mar 12, 2016 at 1:27 AM

Im using in my custom module,

You destroy CKE when form submit, i found on your render code
But when ValidatorOnSubmit is False, the form is cancel submit, but CKE still destroyed
<script type="text/javascript"> //<![CDATA[ function WebForm_OnSubmit() { if (CKEDITOR && CKEDITOR.instances && CKEDITOR.instances.dnn_ctr5501_AdminEditArticle_txtContent_txtContent) { CKEDITOR.instances.dnn_ctr5501_AdminEditArticle_txtContent_txtContent.updateElement(); CKEDITOR.instances.dnn_ctr5501_AdminEditArticle_txtContent_txtContent.destroy(); }; __if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;__ return true; } //]]> </script> i think you must fix in this
<script type="text/javascript"> //<![CDATA[ function WebForm_OnSubmit() { //Move validator check on top __if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;__ //If validator isValid, then destroy CKE instances if (CKEDITOR && CKEDITOR.instances && CKEDITOR.instances.dnn_ctr5501_AdminEditArticle_txtContent_txtContent) { CKEDITOR.instances.dnn_ctr5501_AdminEditArticle_txtContent_txtContent.updateElement(); CKEDITOR.instances.dnn_ctr5501_AdminEditArticle_txtContent_txtContent.destroy(); }; return true; } //]]> </script> Thanks for your reply.

thienvc wrote Mar 12, 2016 at 1:37 AM

Temp im must fix on client-side by this code

Call setTimeout onClick lbtSave, if CKE destoyed then re-load it.

setTimeout(function(){
    //ko có _busyRequest sẽ gây conflic CKE
    if(_busyRequest) return;

    console.log('click Save delay 100');
    if(CKEDITOR && CKEDITOR.instances 
        && typeof(CKEDITOR.instances.<%=txtContent.ClientID%>_txtContent)== 'undefined'
        && typeof(LoadCKEditorInstance_<%=txtContent.ClientID%>_txtContent)!= 'undefined')
        {
            console.log('reloadCKE');
            LoadCKEditorInstance_<%=txtContent.ClientID%>_txtContent();
        }
}, 100);

tha_watcha wrote Mar 19, 2016 at 2:52 PM

Did you check the render code if it works or not your solution. If yes feel free to send a pull request

wrote Mar 30 at 1:22 PM