JavaScript: It's Just Not Validation!

Y-Validator author Colin Morris has written a post 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 […]

Y-Validator author Colin Morris has written a post 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.

DownloadPHP-Validate code and sample form Java, Scripts, JavaScript, Validation, PHP

Source:→ ajaxian