skip to content rich footer

stevenclark.com.au

subscibe to the StevenClark.com.au rss feed

Why Hijax (or Ajax) on Forms is No Good

On a recent team project that had an accessibility / usability requirement my influence (almost insanely) tipped us from accessible to inaccessible on the contact form. My motivation was wanting to experiment with Jeremy Keith’s Hijax so there’s nobody to blame but me.

Initially we did all of our crucial form validation in a Hypertext Preprocessor (PHP) script and enhanced the form unobtrusively with a second JavaScript file that did very basic empty field and email format checks. If the user had JavaScript enabled that’s great but if they didn’t then they simply got the same experience from PHP, only it was slower due to the page refresh.

That’s good. That’s how it needs to be. The idea is to save tying up the server unnecessarily with requests and responses that can be avoided on the client.

But then I thought that I really wanted to experiment with Hijax regardless of the theory. Ajax just looks and sounds cool, right? Who’s with me there. So basically we used Jeremy’s Hijax script to hijack the request / response and the PHP script did all the work. It looks very swish and cool when you’re explaining it all to someone for the first time.

Here’s why its a bad thing. Yes I knew this theory in advance, too. First the user (me included) is going to hit that Back Button to go to the last state – which takes them to the last page visited. It breaks user expectation and I seemed a major culprit at hitting the Back Button even as a developer. That should be a sign. The second big reason was that this was inaccessible (or at least unusable to some of the audience  with disabilities) because screen readers don’t get notified there was an update to the page. So although a fancy notification was entered into the label that something was invalid, users of assistive technologies just don’t know of the update and could be waiting for this form to process. Which it won’t, of course. It’s again waiting for valid input.

What I have come to realise is that if we are going to play with Ajax at all on projects it should never be anything as critical as a contact form. When we know a better way versus a cooler and trendier way we need to be bold enough to follow the best technical path towards the goal. I just thought I’d mention that, preaching to the converted, because we all make bad decisions sometimes in our work. None of us are perfect. Especially under pressure and with deadlines.

Comments are closed.

Social Networking

Keep an eye out for me on Twitter

About the Author

Steven Clark Steven Clark - the stand up guy on this site

My name is Steven Clark (aka nortypig) and my passions are business, web development, photography and writing. I have an MBA (Specialisation) and a Bachelor of Computing from the University of Tasmania. I am working as a business management consultant.

Photography

My photography is at Steven Clark Studio and my regular photo blog presents an ongoing stream of latest images at Walk a Mile in my Shoes and I'm working on a long-term photography project called the King Island Project.

Recently Reviewed Books

Site Supporters

Hosted by Brett Drinkwater at Tashosting who is always there at the other end of my every inconvenient question and technical crisis. Brett's local community support for us over the last five years is greatly appreciated.

skip to top of page

Currently Reading

Ansel Adams: The Camera

As the first of three parts of Ansel Adams Photography Series, Ansel Adams: The Camera begins by discussing the idea of visualisation in relation to photography. Ansel Adams is a master of his craft; this series has sat on my backburner for some time. Book 2 in this series is The Negative and it's followed up by The Print. In them Ansel outlines his philosophy of photography rather than trying to lay down a set of rules. This first instalment is a technical book that explains the good old fashion film camera.