February 08, 2005

JavaScript validation and DTD's

A List Apart released a great article (or so I think, though it is "controversial" in the web community) discussing a clean (read standards focused) way of handling JavaScript behaviors.

The JavaScript Triggers article analyzes the current standards/symantec problem with incorporating event triggers in your XHTML. If you are working toward true separation of concerns (keeping logic, content, and style separate) this seems to be the way to go.

The author, building on this conclusion, demonstrates a method to creat custom elements in XHTML to use with JavaScript. He creates a "required" and "maxlength" attribute to use in form validation.

This works "out of the box" until you want to validation your page through and XHTML validator. To get around the errors generated by the new para-standard elements, the author shows how to create a custom DTD to extend the XHTML standard to support your new elements.

This is likely the way I'll be going with any web apps I build in the future. The approach makes the most sense when it comes to balancing separation of concerns on the client side.

Posted by TheIdeaMan at February 8, 2005 09:37 AM | TrackBack
Comments
Post a comment









Remember personal info?