This is a migrated thread and some comments may be shown as answers.

Error in editor event

3 Answers 190 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 17 Jan 2013, 03:04 AM
Hi, 
When I used select event in editor widget, it work in IE<=8, but not work in 9 and 10,  When I debuging, js code throw exception saying that "Object doesn't support property or method 'getSelection'",  some times, saying method "replace" and key-down event also happen this error in IE10, the js code file is "kendo.all.min.js" and "kendo.web.min.js", is it not supported in IE9 and IE10?
thx

3 Answers, 1 is accepted

Sort by
0
Accepted
Iliana Dyankova
Telerik team
answered on 18 Jan 2013, 03:31 PM
Hi Jason,

I tried to reproduce the problem in both IE 9 and IE 10 but to no avail - the select event of the editor is fired as expected. Could you please provide a jsFiddle / jsBin example which demonstrates your current implementation? This way I would be able to investigate the case and provide concrete recommendations. Thank you in advance.
 
Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jason
Top achievements
Rank 1
answered on 21 Jan 2013, 07:42 AM
Hi Iliana,

Thanks for reply so fast.
I want to save data immediately so
I used the follow event, below is my code:

function onKeyDown(e) {

    var isApply = editorChange();

    if (!isApply && e.keyCode != 8) {

        alert("Your input is too long!");

        e.preventDefault();
    }
}

function onKeyUp(e) {

    var isApply = editorChange();

    if (!isApply && e.keyCode != 8) {

        alert("Your input is too long!");

        e.preventDefault();

    }

}

function onSelect(e) {

    var isApply = editorChange();

    if (!isApply) {

        alert("Your input is too long!");

        e.preventDefault();

    }

}

function onPaste(e) {

    var isApply = editorChange();

    if (!isApply) {

        e.html = "";

        return false;

    }

}

// save data and verify length

function editorChange() {

    var myControl =*****;

    var editor = $("#editor").data("kendoEditor");

    var value = parseOutType(_outType,editor.value());

    if (value.length <= myControl.getMaxLength()) {

        myControl.setValue(value);

        return true;

    }

    return false;

}

$("#editor").kendoEditor({

            keydown: onKeyDown,

            keyup: onKeyUp,

            paste: onPaste,

            select: onSelect

        });

below is some error I encountered.

In IE8 only happen when cancel underline:

a.SCRIPT5007: Unable to get value of the property '1': object is null or undefined
kendo.web.min.js, line 18 character 15375   (attached a.png)

b.SCRIPT5007: Unable to get value of the property '2': object is null or undefined
kendo.web.min.js, line 18 character 15399   (attached b.jpg)

When this error happened, I debug itshown in Figure “b.jpg” , editor.value() is error,but editor.textarea.value has correct value. (in editorChange method).

    In IE9 and IE10(IE10 has another error like this, but mothod ‘replace’)  This error happen when select any place of editor, Select event method executed over .

  c.SCRIPT438: Object doesn't support property or method 'getSelection'
  kendo.web.min.js, line 18 character 19508  attached c.png

In IE10 enter key is not work(maybe because of I use key-up event)

And  my page use following  ref:

<link href="styles/kendo.common.min.css" rel="stylesheet" />

    <link href="styles/kendo.rtl.min.css" rel="stylesheet" />

    <link href="styles/kendo.dataviz.min.css" rel="stylesheet" />

    <link href="styles/examples.css" rel="stylesheet" />

    <script language="javascript" type="text/javascript" src="js/jquery.1.8.2.min.js"></script>

    <script language="javascript" type="text/javascript" src="js/kendo.all.min.js"></script>

    <script language="javascript" type="text/javascript" src="js/examples.js"></script>

    <script language="javascript" type="text/javascript" src="js/console.js"></script>

    <script language="javascript" type="text/javascript" src="js/prettify.js"></script>

    <script language="javascript" type="text/javascript" src="js/kendo.dataviz.min.js"></script>

    <script language="javascript" type="text/javascript" src="js/kendo.web.min.js"></script>

I use examples.css and examples.js in order to change theme.

Is there any problem in my code?

0
Jason
Top achievements
Rank 1
answered on 23 Jan 2013, 07:31 AM
Hi Iliana,
Thank you for your support, Most of the problems have been solved, the cause of error is mainly because we use the environment is Microsoft dynamics CRM, the page is embedded in the CRM system page, in our test environment, we found that, when the various versions of the IE browser to open the page, the Document Mode of IE is all to resolved to the IE8 mode, so there are various Abnormal, when we improve the environment situation, most of the problems not on.
Thanks too, wish you have a happy work!

Regards,
Jason
Tags
Editor
Asked by
Jason
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Jason
Top achievements
Rank 1
Share this question
or