You're going to pervert the id to be a list of validation directives? The word that comes to mind is "minefield". Using the id attrinute for anything other than ids is not the most stellar of ideas. (Mine #1: what if two fields need the exact same validation?)
If you want to tack information onto an element, why not do things in a more generally accepted fashion?
For example, in the onload handler:
[ July 13, 2006: Message edited by: Bear Bibeault ]
It certainly is a perversion, but one I am considering. I (mistakenly?) assumed that it would return an array if there was more than one with the same id. Also, I asked for other suggestions to see how inappropriate it seemed;)
Anyhow, the technique that you describe is what I am currently doing. The problem is that the validation is for a very dynamic page that has different elements based on run-time variables. So it certainly have a validate method that dynamically determined which fields needed to be validated and which validation method needed to be called.
That certainly would do it. I wanted to avoid iterating over all the elements because we can have 200-300 elements per form with only 40-50 needing client-side validation. I'm guessing that wouldn't be too big of a performance hit though.
I'm more concerned about browser support of custom attributes. I only have so long to research any given topic, and saw differing opinions on whether or not you should use them in a standard approach.