asp:login form does not submit when you hit enter
        Posted  
        
            by Ben Liyanage
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Ben Liyanage
        
        
        
        Published on 2010-06-08T21:26:37Z
        Indexed on 
            2010/06/08
            21:32 UTC
        
        
        Read the original article
        Hit count: 363
        
I am having an issues while using the <asp:login> tag.  When a user clicks the "login" button, the form will process correctly.  However, when the user hits the enter key, the form self submits and does not process the login, whether it was correct information or not.  I am using a combination of MasterPages, and Umbraco.
My aspx code looks like this:
 <%@ Master Language="C#" MasterPageFile="/masterpages/AccountCenter.master" CodeFile="~/masterpages/Login.master.cs" Inherits="LoginPage" AutoEventWireup="true" %>
<asp:Content ContentPlaceHolderID="RunwayMasterContentPlaceHolder" runat="server">
    <div class="loginBox">
 <div class="AspNet-Login-TitlePanel">Account Center Login</div>
 <asp:label id="output" runat="server"></asp:label>
 <asp:GridView runat="server" id="GridResults" AutoGenerateColumns="true"></asp:GridView>
 <asp:Login destinationpageurl="~/dashboard.aspx" ID="Login1" OnLoggedIn="onLogin" runat="server" TitleText="" FailureText="The login/password combination you provided is invalid." DisplayRememberMe="false"></asp:Login> 
</div>
</asp:Content>
In the actual rendered page, I see this javascript on the form:
<form method="post" action="/dashboard.aspx?" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm">
That javascript function is defined as:
    <script type="text/javascript">
//<![CDATA[
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
//]]>
</script>
The javascript is always evaluating to True when it runs.
© Stack Overflow or respective owner