Why bother fixing website bugs...



  • ... when you can just tell visitors how to use the workaround!

    Indeed, pressing enter (as opposed to taking your hands away from the keyboard to click the button) on True Value's store locator will just refresh the current page, instead of submitting the form.



  •  Costco's store locator has a similar problem (http://www.costco.com/Warehouse/locator.aspx?cm_re=1_en--Top_Right_Nav1--Top_locations&topnav=&whse=BC&lang=en-US), only they don't document the "workaround."  If you enter a zip code and press "enter", it submits the "search" form.  That annoys the crap out of me.



  • Didn't the search box on this site do the same thing a little while ago?



  • @Cap'n Steve said:

    Didn't the search box on this site do the same thing a little while ago?

    Yep. It also offered to search Web. Why would you want to do that from TDWTF is beyond my understanding.



  • If you would notice, it has to do with the way ASP.NET renders pages by default. The Enter key does not work on the forms. I hate when sites don't fix that. There can be a single "real" form on the page, and I still have to click the button. So, that "WTF" applies to a large number of ASP.NET websites, especially those developed in 1.x



  • It applies to any ASP.NET page, not just 1.x ones - the entire page must be one big form.

    It's not really something you can fix that easily, since  there's no way to specify another button as the default submit button in pure HTML. You can hack some JavaScript together, or you can replace buttons placed earlier with ImageButtons, as these aren't treated as suitable submit-buttons, but both will fail if the user has disabled scripting (that tradeoff might be okay with you, but I believe JavaScript should be used as little as possible, and, unless completely impossible, that there should always be a fallback if scripting is disabled).



  • @Pidgeot said:

    It applies to any ASP.NET page, not just 1.x ones - the entire page must be one big form.

    Why do people always ignore the qualifiers I use? I said especially, not only. The reason I said it that way is that a lot of the ones I run into that haven't been handled were 1.x pages. The people responsible for the 2.0 pages usually put the JavaScript hack in there.



    I really wish there was a way to remove the full-page form thing and handle the individual forms as needed. I haven't looked into it much, so I don't know the full range of workarounds available.



  • It was meant more as an elaboration than a correction.

    And to elaborate further, you can actually have multiple forms, as long as only one is ever visible, and you can of course also have a formless page. The former case, however doesn't help here, and the latter kinda removes much of the reason to use ASP.NET in the first place.



  • @Pidgeot said:

    It's not really something you can fix that easily, since  there's no way to specify another button as the default submit button in pure HTML. You can hack some JavaScript together,
     

    What? You can't put a name="" parameter on the submit buttons so the browser submits the value="" portion? I do that quite frequently on pages that require different actions performed from a single form. As long as the submit buttons have different values, it's trivial to process server-side. Of course, I'm forced to use PHP because that's what the client wants, but I can't imagine ASP being so utterly broken as to not be able to do this either.

    <form>
    [blah blah blah]
    <input type="submit" name="submit" value="Do Something" />
    <input type="submit" name="submit" value="Whatever Else" />
    </form>

    and then server-side, the equivalent of

    switch($_REQUEST['submit']) {
        case "Do Something":
           ... blah blah blah...
     

     



  • @MarcB said:

    @Pidgeot said:
    It's not really something you can fix that easily, since  there's no way to specify another button as the default submit button in pure HTML. You can hack some JavaScript together,
    What? You can't put a name="" parameter on the submit buttons so the browser submits the value="" portion? I do that quite frequently on pages that require different actions performed from a single form.
    That's the easy part. What is difficult is to get the result of pressing enter in two different textboxes to effectively click two different submit buttons. As it stands, in your example, pressing enter in any textboxt in your form will submit using the first submit button. Which means that if you want to choose the second action, you have to resort to the mouse, or to tabbing to the button and hitting enter....



  • @random_garbage said:

    you have to resort to the mouse, or to tabbing to the button and hitting enter....
     

    Ah yeah... good point. headdesk Sometimes I wonder if Tim Berners-Lee was secretly employed by Microsoft and only hiding out at CERN while coming up with the HTML specs and all the HTTP design. Total lack of foresight like this could only come out of a behemoth like Redmond, or maybe Armonk or San Jose. 



  •  You should never force the user to do an unnatural action. In this case, it is very natural for a user to type a number and press enter.

     The message should at least be "click button" rather than "don't press" if they want to try to force an action.



  • @AbbydonKrafts said:

    @Pidgeot said:
    It applies to any ASP.NET page, not just 1.x ones - the entire page must be one big form.

    Why do people always ignore the qualifiers I use? I said especially, not only. The reason I said it that way is that a lot of the ones I run into that haven't been handled were 1.x pages. The people responsible for the 2.0 pages usually put the JavaScript hack in there.



    I really wish there was a way to remove the full-page form thing and handle the individual forms as needed. I haven't looked into it much, so I don't know the full range of workarounds available.

    All you have to do is wrap all your grouped form elements in an <asp:Panel> (and possibly other containers - I haven't checked) with its DefaultButton property set to the ID of the button you want to be the default - i.e. the "enter key button". I do this all the time, and it works just as expected in both IE and Firefox.

    <asp:Panel ID="TheFirstFormPanel" DefaultButton="TheFirstFormPanelSubmitButton" runat="server">
      <asp:TextBox ID="SomeData" runat="server" />
      <asp:Button ID="TheFirstFormPanelSubmitButton" Text="Submit" runat="server" />
    </asp:Panel>
    <asp:Panel ID="TheSecondFormPanel" DefaultButton="TheSecondFormPanelSubmitButton" runat="server">
      <asp:TextBox ID="SomeMoreData" runat="server" />
      <asp:Button ID="TheSecondFormPanelSubmitButton" Text="Submit" runat="server" />
    </asp:Panel>

    Then when you hit enter while an input within the panel is focused, it fires the OnClick event for whatever button you've set as the default. Dead-simple, and documented. Not sure why everyone resorts to Javascript hacks all the time.



  • @MarcB said:

    Sometimes I wonder if Tim Berners-Lee was secretly employed by Microsoft and only hiding out at CERN while coming up with the HTML specs and all the HTTP design.

    To be fair to Tim Berners-Lee, HTML was never meant to become a platform for rich media and application design.  It started as a simple document storage and retrieval system with the ability to link between documents.

     

    @MarcB said:

    Total lack of foresight like this could only come out of a behemoth like Redmond, or maybe Armonk or San Jose.

    eye roll  Yeah, I'm sure everyone who works for Microsoft and IBM is a complete idiot who can't plan ahead at all.  If only we had MarcB to lead us, all of our technical woes would vanish! 

     


  • Winner of the 2016 Presidential Election


    As I've pointed out in previous posts, pure HTML provides a perfectly valid and simple way to specify which action "enter" will do. The correct way is to have a separate form tag for each discrete action. This works with most server-side languages, but not ASP.NET. ASP.NET only allows one big form, so you have to use a JavaScript hack to get around it.

    I love the .NET Framework and C# as a language, but the ASP parts of ASP.NET still make me a little ill.


  • Winner of the 2016 Presidential Election

    @db2 said:

    Then when you hit enter while an input within the panel is focused, it fires the OnClick event for whatever button you've set as the default. Dead-simple, and documented. Not sure why everyone resorts to Javascript hacks all the time.

    That was introduced in ASP.NET 2.0, so it wasn't available in 1.1. Not to mention that the rendered output of that attribute is a JavaScript hack, as well.



  • @joe.edwards said:

    @db2 said:

    Then when you hit enter while an input within the panel is focused, it fires the OnClick event for whatever button you've set as the default. Dead-simple, and documented. Not sure why everyone resorts to Javascript hacks all the time.

    That was introduced in ASP.NET 2.0, so it wasn't available in 1.1. Not to mention that the rendered output of that attribute is a JavaScript hack, as well.

    So is pretty much the entire postback mechanism. If you're turned off by a few javascript tricks to handle form submission, then you're using the wrong web framework. 😛



  • @db2 said:

    So is pretty much the entire postback mechanism. If you're turned off by a few javascript tricks to handle form submission, then you're using the wrong web framework. 😛

    Are you saying it's almost impossible to develop a user-friendly site in ASP.NET that does not utilize JavaScript? If so, I may have to rethink my plans of using ASP.NET for a new site (I haven't used it at all yet BTW). I can't be scaring away people that have JavaScript disabled.



  • @AbbydonKrafts said:

    @db2 said:
    So is pretty much the entire postback mechanism. If you're turned off by a few javascript tricks to handle form submission, then you're using the wrong web framework. 😛

    Are you saying it's almost impossible to develop a user-friendly site in ASP.NET that does not utilize JavaScript? If so, I may have to rethink my plans of using ASP.NET for a new site (I haven't used it at all yet BTW). I can't be scaring away people that have JavaScript disabled.

    To be honest, I haven't really played around very extensively with how gracefully it degrades in the absence of Javascript on the browser. It's entirely possible that basic stuff like buttons and fields will work fine without it (and frankly I'd be kind of surprised if they didn't). But I know you can end up with a lot of things that fire postback events that aren't actually submit buttons, such as GridView fields, headers, or paging links for instance - basically, anything that calls doPostBack in the onclick handler. This site is pretty much all ASP.NET I think, so maybe someone can NoScript it and report back how well it functions.

    If you have a legitimate need to ensure zero javascript whatsoever, then ASP.NET can probably be ruled out. If you have no issue coexisting with it, then ASP.NET is really pretty nice to work with.



  • @db2 said:

    To be honest, I haven't really played around very extensively with how gracefully it degrades in the absence of Javascript on the browser.

    MSDN will tell you what will and will not work in ASP.NET without JavaScript: http://msdn2.microsoft.com/en-us/library/ms178206.aspx.

    If you avoid these things (or ensure a fallback, for example by adding a button to manually submit fields that would have used AutoPostBack), ~99.9% of the code should not need to take any additional considerations.



  • @MarcB said:

    Sometimes I wonder if Tim Berners-Lee was secretly employed by Microsoft and only hiding out at CERN while coming up with the HTML specs and all the HTTP design. Total lack of foresight like this could only come out of a behemoth like Redmond, or maybe Armonk or San Jose. 
     

    Right. And you forgot to mention that M$ secretly funded Hitler and the Third Reich during WWII as well. You also forgot to use the '$' in Micro$oft.

    I mean, as long as you're being an idiot who blames MS for everything under the sun, even when they couldn't possibly have had anything to do with it, you might as well look like a total idiot.



  • @KenW said:

     

    Right. And you forgot to mention that M$ secretly funded Hitler and the Third Reich during WWII as well. You also forgot to use the '$' in Micro$oft.

    I mean, as long as you're being an idiot who blames MS for everything under the sun, even when they couldn't possibly have had anything to do with it, you might as well look like a total idiot.

    I want to be the first fool that mentions Godwin's law!



  • @belgariontheking said:

    I want to be the first fool that mentions Godwin's law!
    Hail Hitler!


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.