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

Microsoft Jscript runtime error:'OnClientLoad' undefined

2 Answers 103 Views
Editor
This is a migrated thread and some comments may be shown as answers.
NVB
Top achievements
Rank 1
NVB asked on 01 Feb 2012, 01:23 AM
I am getting runtime error  " Microsoft JScript runtime error: 'ONClientLoad' is undefined

I have radeditor defined with  clientside event

 <telerik:RadEditor ID="RadEditor3" Runat="server" EditModes="Design, Preview"

 StripFormattingOnPaste="MSWordNoFonts" Width="100%" OnClientLoad="OnClientLoad"

 AutoResizeHeight="false" BorderStyle="None" Height="530px" Skin="Office2007" >


Javascript function is

function OnClientLoad(editor) {
           editor.attachEventHandler("onkeydown", function(e) {
               var content = editor.get_text(); //returns the editor's content as plain text
               var words = 0;
               if (content) {
                   var punctRegX = /[!\.?;,:&_\-\-\{\}\[\]\(\)~#'"]/g;
                   var contentcontent = content.replace(punctRegX, "");
                   var trimRegX = /(^\s+)|(\s+$)/g;
                   contentcontent = content.replace(trimRegX, "");
                   if (content) {
                       splitRegX = /\s+/;
                       var array = content.split(splitRegX);
                       words = array.length;
                   }
               }
               // var counter = $get("counter");
               // counter.innerHTML = "Words: " + words + " Characters: " + content.length;
               var wcountLabel = document.getElementById("<%= lblWordCount.ClientID %>";
               var hfwcountId = document.getElementById("<%= hfWordCount.ClientID %>");
               wcountLabel.innerText = "Words: " + words;
               hfwcountId.innerText = words 
           });

Please let me know what I am missing here

Thanks

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 01 Feb 2012, 07:32 AM
Hello,

I have tried to reproduce the same but no avail. When I examined your code, I found that the function is not closed properly.
JS:
<script type="text/javascript">
  function OnClientLoad(editor, args)
  {
    editor.attachEventHandler("onkeydown", function(e)
      {
        //your code
      });
  }
</script>

Thanks,
Princy.
0
NVB
Top achievements
Rank 1
answered on 01 Feb 2012, 07:19 PM
Thanks Princy.
Tags
Editor
Asked by
NVB
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
NVB
Top achievements
Rank 1
Share this question
or