Pressing enter fires button click event in Firefox

3 posts, 1 answers
  1. Vlad
    Vlad avatar
    19 posts
    Member since:
    Aug 2012

    Posted 13 Feb 2014 Link to this post

    Hi!

    I have a simple aspx page, containing one button and one combobox:

        <section id="content" class="content">     
            <article id="actions">
                <telerik:RadButton ID="btnNewEvent" runat="server" RenderMode="Lightweight"
                    Text="<%$ Resources:App,NewEvent %>" AutoPostBack="false"
                    OnClientClicked="btnNewEvent_Clicked">
                </telerik:RadButton>
            </article>
            <article id="search" class="search">
                <telerik:RadComboBox ID="cmbxSearch" runat="server" RenderMode="Lightweight"
                    CssClass="search-field" EmptyMessage="<%$ Resources:App,SearchFieldEmptyMessage %>"
                    AllowCustomText="true" EnableLoadOnDemand="True" MarkFirstMatch="false"
                    OnClientLoad="cmbxSearch_Load"
                    OnClientSelectedIndexChanged="cmbxSearch_SelectedIndexChanged">
                </telerik:RadComboBox>
            </article>
        </section>

    Javascript:

    function btnNewEvent_Clicked(s, e) {
        alert("TODO: Open RAD window");
    }

    function cmbxSearch_Load(s, e) {
        var input = s.get_inputDomElement();
        input.focus();
    }

    function cmbxSearch_SelectedIndexChanged(s, e) {
        alert("TODO: Search");
    }

    If I press on btnNewEvent, alert saying "TODO: Open RAD window" is displayed, which is correct.
    If I type some text into cmbxSearch (RadComboBox), in Firefox browser, I get two alerts. First one is saying "TODO: Open RAD window", the other one "TODO: Search". Why is button event triggered on enter key pressed? In IE, everything works as expected.

    I am using Windows 8 with IE 10 and Firefox 26 and telerik UI controls v2013.2.717.40.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 Feb 2014 in reply to Vlad Link to this post

    Hi Vlad,

    Can you try setting UseSubmitBehavior="false" for the RadButton.

    ASPX:
    <telerik:RadButton ID="btnNewEvent" runat="server" Text="Click" UseSubmitBehavior="false". .>
    </telerik:RadButton>

    Thanks,
    Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vlad
    Vlad avatar
    19 posts
    Member since:
    Aug 2012

    Posted 17 Feb 2014 in reply to Princy Link to this post

    That did the trick. Thanks.
Back to Top