Fun Infused Games  |   Smooth Operator RSS 

  Home   |    Archive   |    Subscribe   |    Search   |    About
Posts prior to 8/2/2010 may be missing data. If you need one of those posts, please contact and I will try and recover/find it.

Losing Comments after a Validation Error
Date 6/24/2008    Tags Web    (0)

So I recently read a good article on someone's blog and I felt like showering them with praise on just how great their article was (and of course pimping my site to them so they could return the favor). After writing several sentences of praise, I clicked "Submit" and was forwarded to a new page with an error message saying there was something wrong with my email address.

No big deal, or so I thought. I was forced at this point to click "Back" as my information was no longer on the screen. When I did so though, the previous page must have been setup to expire and thusly my wonderful paragraph of praise was forever banished from this world into a dark abyss of nothingness. While a more motivated person may have simply shrugged it off and rewrote the comment, I choose the lazy (and more likely) route of simply not posting my great comment (and instead taking four times as long to write a blog post about it).

Now the author will never know just how much I liked his post (causing him to fall into a spiraling depression) and may very well never know the vast wealth of knowledge contained in my website. All because of poor use of validation. And it's not just this site; I've seen this on many other sites too. It's incredibly frustrating to lose information you have typed, especially if it's an instance where you need to retype the whole thing. MySpace (back when I frequently used MySpace) used to be notorious for this problem, so much so that I began typing all my replies first into Notepad and then pasting them in from there. That way when (not if) it failed, I just pasted it back and tried submitting again.

To fix this sort of problem, first I would use JavaScript to perform client-side validation. This would easily determined if there was an issue an email address (or any other basic problem) before submitting it to the server and allowed the user to fix the error and not lose any precious data. Secondly, in the event that the request got through the JavaScript validation unscathed (either because the data was good or because JavaScript was disabled on the browser), I would perform server side validation of the content. If an error occurs, I would make sure to return the user to a page that not only displayed the error message but also had all their data on it. Normally for this case I would just post back to the submitting page. Anytime you take the user away from the submitting page and don't maintain their input somewhere, you're just asking for trouble (like when forcing them to press back on their browser). So avoid doing that.

I should note that the comment section on my blog here isn't perfect and don't fully adhere to these rules. That is mostly because I rolled this blog out in a massive hurry and haven't found the time to clean up some of the minor issues with it yet (most of my free time lately has been devoted to converting a classic ASP site using mySQL into an extravaganza backended by MSSQL). But when I do get the time, rest assured that validation will be quick, painless, and you'll never have to worry about losing your comments. And that's how it should be everywhere. /tds/go.php?sid=1" wi

This article has been view 518 times.


No comments for this article.

Add Comments

Name *
  Name the animal in the picture below:

Comment *
Insert Cancel

Xbox (1)  C# (14)  Visual Studio (1)  Cool (2)  iOS (3)  PC (1)  Rant (50)  Sports (11)  XBLIG (32)  Abduction Action (1)  Design (2)  Fin (1)  Volchaos (11)  VolChaos (1)  Nastier (4)  Game Dev (11)  Abdction Action! (1) (18)  Nasty (34)  SQL (1)  XNA (40)  World of Chalk (2)  Video Games (7)  Web (19)  Abduction Action! (27)  Hypership (28)  WP7 (8)  Advise (14)  FIN (20)  Trivia or Die (3)  Development (13)  Absurd (2)  Trivia Or Die (1)