AutoPostBack on Enter Key ?

Last post 05-12-2005, 11:53 AM by cutechat. 1 replies.
Sort Posts: Previous Next
  •  05-12-2005, 10:27 AM 6616

    AutoPostBack on Enter Key ?

    Is it possible to have an AutoPostback Event for a form containing the CE using the Enter Key.   I would like to create a chat application using CE , but I don't want the user to have to click a "Send" button.  I would like to be able to use a AutoPostBack Event like a normal ASP.Net TextBox.
  •  05-12-2005, 11:53 AM 6621 in reply to 6616

    Re: AutoPostBack on Enter Key ?

    Hello:
     
    Plage try this script:
     
     
    <script runat="server">
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        Editor1.Attributes["oninitialized"] = "Client_Handle_Editor_Initialized(this)";
    }
    </script>
    <script>
    function Client_Handle_Editor_Initialized(editor)
    {
     editor.GetDocument().onkeydown=function()
     {
      var event=editor.GetDocument().parentWindow.event;
      if(event.keyCode==13)//ENTER
      {
          editor.ExecCommand("PostBack",false,"Save");
         
          event.cancelBubble=true;
          event.returnValue=false;
      }
     }
    }
    </script>
     
     
    Regards , Terry .
View as RSS news feed in XML