Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Josh Olson 79 posts 207 karma points
    Mar 01, 2013 @ 10:18
    Josh Olson
    0

    Possible bug: html <input> button control with name="submit" breaks <asp:LoginStatus> control on same page

    Hey all,

    I don't know if this has anything to do with Umbraco, or if this is an 'undocumented feature' from some other area, but I thought I would let the community know about this interesting situation:

    I have a masterpage that uses an <asp:LoginView> with the standard <asp:LoginStatus> as part of the <LoggedInTemplate> section in order to facilitate users logging in and out

    <asp:LoginView ID="LoginViewMaster" runat="server">
    <AnonymousTemplate>
    Guest! [ <a id="loginLink" name="loginLink" class="modalInput" rel="#login" style="cursor:pointer" >Login</a> ] [ <a id="registerLink" name="registerLink" class="modalInput" rel="#register" style="cursor:pointer" >Register</a> ]
    <div class="modal" id="login">
    <asp:Login ID="Login1" runat="server"></asp:Login>
    </div>
    <div class="modal" id="register">
    <asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
    <WizardSteps>
    <asp:CreateUserWizardStep runat="server" />
    <asp:CompleteWizardStep runat="server" />
    </WizardSteps>
    </asp:CreateUserWizard>
    </div>
    </AnonymousTemplate>
    <LoggedInTemplate>
    <umbraco:Macro Alias="LoginAreaLeft" runat="server" />
    <asp:LoginStatus ID="LoginStatus1" runat="server" />
    <umbraco:Macro Alias="LoginAreaRight" runat="server" /> </LoggedInTemplate>
    </asp:LoginView>

    This all occurs in the header section of the master template, as you commonly see on webpages.  On a child template of that master template I have a macro that creates a complex form which makes use of standard HTML <input> controls. On that form, there is a button sitting at the bottom unused (still developing the form) that just happens to look like this:

    <input name="submit" class="buttonFooter" type="button" value="Submit" />

    (In this form, 'submitting' the form simply indicates it is ready for processing, whereas 'saving' the form, accomplished through another button, is what is doing the Post) Now, I haven't gotten to dealing with the submit button yet, so it was just hanging out down there, not doing any harm, or so I thought.  What I found though, is that the 'Logout' action via the <asp:LoginStatus> would not work on this one particular page.  After a rigurous search through my code, I discovered that if I change the name of the button to anything besides 'submit', problem solved, but as long as there was a control of type="button" and with a name="submit" you could not log out while on that page through the <asp:LoginStatus> control.

    Because I am still learning .NET, I am not certain what the root cause of this behavior is, but Umbraco does not seem likely to be at fault. Regardless, I though I should share with the community and see if someone with more expierence/knowledge could shed some light on the situation.

    Cheers!

    - Josh

  • Mike Chambers 636 posts 1253 karma points c-trib
    Mar 01, 2013 @ 21:37
    Mike Chambers
    0

    root of the cause is that there is also prob a javascript function called submit too.. and that is why you shouldn't use name="submit" on the button too.. the browser gets confused between the two...

    or at least that's what I found to be the case when I stumbled on the same issue.

  • Josh Olson 79 posts 207 karma points
    Mar 04, 2013 @ 08:25
    Josh Olson
    0

    Hey Mike,

    Yeah, I realized that of course there must be a naming issue overlap, it just seemed odd to me that the situation as described above should be allowed to occur, or if it is a known issue, why did I not see more documentation about it?  I mean, one would think that on the asp.net websites with all the walkthrough and tutorials that they have regarding using the asp controls, specifically the asp:LoginStatus and related controls, there would be some warnings or cautionary statments like, "don't use the name 'submit' on any of your controls if you are using these asp controls..."

    Thanks for the reply though Mike, I am glad to know I am not the only one who stubled across this issue!

    Cheers!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies