This is a migrated thread and some comments may be shown as answers.
EnableSingleInputRendering and FormSubmit
5 Answers 117 Views
This is a migrated thread and some comments may be shown as answers.
Max
Top achievements
Rank 1
Max asked on 01 Feb 2012, 09:58 AM
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

5 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 01 Feb 2012, 01:17 PM
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
0
Max
Top achievements
Rank 1
answered on 02 Feb 2012, 08:04 AM
<%@ 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;
//            }
//        }
    }
}

0
Vinoth Arun
Top achievements
Rank 2
answered on 02 Feb 2012, 01:05 PM
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";
      }
0
Max
Top achievements
Rank 1
answered on 02 Feb 2012, 03:18 PM
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
0
Vasil
Telerik team
answered on 06 Feb 2012, 01:03 PM
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 >>
Tags
Input
Asked by
Max
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Max
Top achievements
Rank 1
Vinoth Arun
Top achievements
Rank 2
Share this question
or