RadDatePicker DateInput-ClientEvents-OnKeyPress Not Firing For Enter Key (keycode 13)

4 posts, 0 answers
  1. Brian
    Brian avatar
    2 posts
    Member since:
    Apr 2009

    Posted 21 Jan 2010 Link to this post

    Hello,

    I would like to handle the OnKeyPress event to put focus on the next input control on the form when the enter key is pressed.  I have this working for textboxes and comboboxes, and can focus the dateinput in the datepicker, but the enter key is not firing the OnKeyPress client event for the datepicker's dateinput control.  The first debugger statement is hit when I enter a normal text key (e.g. '1', 'a'), but when hitting the enter key, nothing happens (the keyPressed_textbox function is never executed).  Any ideas why the enter key is not firing the event?


     
                                    <telerik:RadDatePicker   
                                        DateInput-ClientEvents-OnKeyPress="keyPressed_textbox"   
                                        TabIndex="5"   
                                        runat="server"   
                                        ID="datepickerDob"   
                                        Width="180px"   
                                        MinDate="1/1/1900"   
                                        CssClass="body_copy" /> 

     
     
                function keyPressed_textbox(sender, args) {  
                    debugger;  
                    if ( 13 == args.get_keyCode() ) {  
     
                        /* never gets here for RadDatePicker's DateInput OnKeyPress event */ 
                    }  
                } 

    edit: I have a similar problem with RadComboBoxes that have MarkFirstMatch set to true - the enter key does not fire the OnClientKeyPressing event, but the event is fired when MarkFirstMatch is set to false.  Is there anything I can do about this?
  2. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 26 Jan 2010 Link to this post

    Hello Brian,

    You could try to attach the KeyUp/KeyDown event instead:
    <telerik:RadDatePicker
       TabIndex="5"
       runat="server"
       ID="datepickerDob"   
       Width="180px"
       onkeydown="keyDown(this, event)"
       MinDate="1/1/1900"
       CssClass="body_copy" />

    <script type="text/javascript">
        function keyDown(sender, e)
        {
            e = e || window.event;
            if (e.keyCode == 13)
                //do something
        }
    </script>

    Let me know whether this helps.

    Best regards,
    Daniel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Brian
    Brian avatar
    2 posts
    Member since:
    Apr 2009

    Posted 26 Jan 2010 Link to this post

    Using the key up event solved my issue with the RadDatePicker.  However, I still have an issue with RadComboxBox - when MarkFirstMatch = true and I have typed text into the RadComboBox or I have selected and item from the drop down list, I cannot focus another control from the key pressed or key up events.  I cannot blur the RadComboBox, either.  But, as I said, if MarkFirstMatch is false or there is no text in the RadComboBox, I can focus another control from these events.
  4. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 29 Jan 2010 Link to this post

    Hello Brian,

    Please test the attached demo and let me know whether it works properly on your end.

    Best regards,
    Daniel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top