EnableSingleInputRendering and FormSubmit

6 posts, 0 answers
  1. Max
    Max avatar
    34 posts
    Member since:
    Dec 2011

    Posted 01 Feb 2012 Link to this post

    Hi,
     When EnableSingleInputRendering is "true" for a PasswordField (RadTextBox), all submit behaviors of form and buttons are not working.
    <form id="form1" runat="server" defaultbutton="LogOn" acceptbutton="LogOn" >
    <telerik:RadButton ID="LogOn" runat="server" Text="Login" OnClick="LogOn_Click" UseSubmitBehavior="true">
                                            </telerik:RadButton>

    Neither ENTER triggers postback nor can I invoke it programmatically from JS.

    Clicking on the button, however, works.

    Thanks for help,
     Max
  2. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 01 Feb 2012 Link to this post

    Hi Max,

    We are aware that the default button is not executed when you click Enter in the input with EnableSingleInputRendering=True , and we are currently working on this issue.
    However making PostBack using JavaScript should work as expected. Could you share an example code with us for further debugging here?

    Kind regards,
    Vasil
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Max
    Max avatar
    34 posts
    Member since:
    Dec 2011

    Posted 02 Feb 2012 Link to this post

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Auth.aspx.cs" Inherits="Org.Auth" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title></title>
    </head>
    <body onload="CheckRadWindow();" onkeydown="Keydown(event);">
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="ScriptManager" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadFormDecorator ID="RadFormDecorator" runat="server" Skin="WebBlue" DecoratedControls="All" />
                                <telerik:RadTextBox ID="Password" runat="server" TextMode="Password"  EmptyMessage="password" EmptyMessageStyle-BackColor="Yellow"  EnableSingleInputRendering="true">
                            </telerik:RadTextBox>
                                            <telerik:RadButton ID="LogOn" runat="server" Text="Enter" OnClick="LogOn_Click" UseSubmitBehavior="true">
                                            </telerik:RadButton>
    </form>
    </body>
    </html>
    // Auth.js
    function
    Keydown(event) { // Triggers Ok
        var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
        // process only the Enter key
        if (keyCode == 13) {
            document.form1.submit();
             
    //        var inputs = document.getElementsByTagName('input');
    //        for (var i = 0; i < inputs.length; i++) {
    //            if (inputs[i].getAttribute('type') == 'submit') {
    //                inputs[i].onclick = "LogOn_Click";
    //                inputs[i].click();
    //                document.form1.submit();
    //                return;
    //            }
    //        }
        }
    }

  5. Vinoth
    Vinoth avatar
    25 posts
    Member since:
    Aug 2012

    Posted 02 Feb 2012 Link to this post

    Hi Max

    Try this,

    <form id="form1" runat="server" defaultbutton="rbtnLogon" acceptbutton="rbtnLogon">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadTextBox ID="RadTextBox1" runat="server">
        </telerik:RadTextBox>
        <telerik:RadTextBox ID="RadTextBox2" EnableSingleInputRendering="true" runat="server"
            TextMode="Password">
        </telerik:RadTextBox>
        <telerik:RadTextBox ID="Password" runat="server" TextMode="Password"  EmptyMessage="password" EmptyMessageStyle-BackColor="Yellow"  EnableSingleInputRendering="true">
                            </telerik:RadTextBox>
                            <br />
        <telerik:RadButton ID="rbtnLogon" runat="server" Text="Login" OnClick="RadButton1_Click"
            UseSubmitBehavior="true">
        </telerik:RadButton>
        <telerik:RadButton ID="rbtnnormal" runat="server" Text="Temp Button" OnClick="RadButton1_Click">
        </telerik:RadButton>
        </form>
    protected void RadButton1_Click(object sender, EventArgs e)
          {
              RadTextBox1.Text = "Test";
          }
  6. Max
    Max avatar
    34 posts
    Member since:
    Dec 2011

    Posted 02 Feb 2012 Link to this post

    Hi Vinoth,

    what *is* expected> pressing Enter anywhere on the page would trigger postback / function in code-behind.

    In example above Enter-key works only within RadTextBox1 and (c.o. with focus set on any of two buttons). Solution? - No.

    So the problem is in correct overriding broken submit-behavior / keydown event when any of ESIR-true TextBoxes is focused.

    Cheers,
     Max
  7. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 06 Feb 2012 Link to this post

    Hello Max,

    Thank you for the provided code. I used this example and a PostBack is happening when the keydown is coming from another control. Indeed the problem is when you press enter inside the RadTextBox, since the keydown event get canceled. I as mentioned earlier, this issue is known to us and we will try to fix it.

    Greetings,
    Vasil
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017