Wednesday, January 2nd, 2008

JavaScript: It’s Just Not Validation!

Category: Articles, JavaScript

Colin Morris, author of Y-Validator, has written a piece on JavaScript: It’s Just Not Validation! which discusses JavaScript validation, and “input assistance”:

JavaScript input assistance, when built separately from back-end validation, is not ideal. At worst, the two piece of functionality work differently, and what’s valid on the client side isn’t valid at the server. At best they work fine — initially. But with validation logic in multiple locations, there’s an increasing likelihood that only one will get updated when changes are required, at which point we get inconsistent results.

Finally, back-end validation is required. JavaScript assistance is nice.

The use of a central object to manage both the validation and input assistance tasks creates a consistent end user experience even with JavaScript disabled.

  • We have one place to update both the enhancement (JavaScript assistance) and the required functionality (back-end validation). Therefore, the two can’t get out of step, and we can ensure a seamless experience for the user.
  • We have one place to find the enhancement, so it’s less confusing for future maintainers of our code to located the points at which various validations and assistances are implemented in the code.
  • The code also promotes the separation of behaviour from presentation. The programmer programs the validation and the designer implements the presentation of the feedback.
  • The user feels in more control, having confidence in hitting the big submit button.

Don’t forget: the code for the PHP-Validate and a sample form is available for download.

Posted by Dion Almaer at 12:05 am
1 Comment

3.3 rating from 20 votes

1 Comment »

Comments feed TrackBack URI

That’s it, pure and logical. I never understood those JS validation tools cause you HAVE to validate serverside.

Comment by webEater — January 2, 2008

Leave a comment

You must be logged in to post a comment.