[CLOSED] SpecialKey doesn't work good with ENTER key

  1. #1

    [CLOSED] SpecialKey doesn't work good with ENTER key

    Hello Team, I have a issue with a TextField:

    I have a DirectEvent in the TextField with SpecialKey and I try to call one function in OnEvent when the ENTER key is pressed, but it doesn't works in he first time, but when I pressed ENTER 2 or 3 times it works. Can you suggest me any solution? Here is my example code and screenshot, thanks team

    Click image for larger version. 

Name:	Captura.PNG 
Views:	3 
Size:	2.0 KB 
ID:	21791


    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="texfieldkey.aspx.cs" Inherits="OSEF.ERP.APP.texfieldkey" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <ext:ResourceManager ID="ResourceManager1" runat="server">
            </ext:ResourceManager>
    
    
             <ext:TextField 
                        ID="txtTest"
                        runat="server"
                        AutoFocus="true">
                        <DirectEvents>
                            <SpecialKey
                                Before="return e.getKey() == Ext.EventObject.ENTER"
                                OnEvent="txtfEnviarCorreo_SpecialKey">
                            </SpecialKey>
                        </DirectEvents>
                    </ext:TextField>
            <ext:Label ID="lblTest" runat="server" Text="Here">
            </ext:Label>
        </div>
        </form>
    </body>
    </html>
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Ext.Net;
    
    namespace OSEF.ERP.APP
    {
        public partial class texfieldkey : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
    
    
            protected void txtfEnviarCorreo_SpecialKey(object sender, DirectEventArgs e)
            {
                lblTest.Text = "Here Works My Event";
            
            }
    
        }
    }
    Last edited by fabricio.murta; Feb 24, 2015 at 7:39 PM. Reason: [CLOSED]
  2. #2
    Hi @osef
    please try to add TextField property
    EnableKeyEvents="true"
    .
  3. #3
    This doesnt works, but thanks!
  4. #4
    Hi @osef,

    The form is being submitted on Enter key if there is the only input field on the page. Here is a related thread.
    http://forums.ext.net/showthread.php?22424

    Does submitting happen on your side? I guess this functionality breaks a DirectEvent.
  5. #5
    It works fine, thank you

Similar Threads

  1. Replies: 5
    Last Post: Sep 20, 2017, 12:23 AM
  2. Replies: 1
    Last Post: Apr 03, 2012, 9:42 PM
  3. Press Enter key should work on search button
    By Nagaraju in forum 1.x Help
    Replies: 1
    Last Post: Oct 09, 2011, 5:09 PM
  4. [CLOSED] TextField SpecialKey Submit and Enter/Backspace
    By macap in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Apr 28, 2010, 4:20 PM
  5. DatePicker doesn't look good in tab
    By echo in forum 1.x Help
    Replies: 2
    Last Post: Jun 29, 2009, 6:55 AM

Tags for this Thread

Posting Permissions