Microsoft Jscript runtime error:'OnClientLoad' undefined

3 posts, 0 answers
  1. NVB
    NVB avatar
    39 posts
    Member since:
    Apr 2009

    Posted 31 Jan 2012 Link to this post

    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. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 01 Feb 2012 Link to this post

    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.
  3. NVB
    NVB avatar
    39 posts
    Member since:
    Apr 2009

    Posted 01 Feb 2012 Link to this post

    Thanks Princy.
Back to Top