Super easy to deal with on a simple ajax request and it's in place for all requests. If a POST/PUT is done with an ajax request simply return the error message. Otherwise, set the HTTP status code and render the form with the error as the response.
The actual field that doesn't validate needs to be highlighted, because otherwise the disconnect between the error and the source makes it difficult to actually identify the source. The only other thing it needs is to position the error message adjacent to the invalid field.
When HTML5 is implemented better these things could be used more effectively. But HTML5 validation as it is now isn't useful until you can style the browser's errors.
It might be a better idea to hold off on the HTML5 stuff and work on polishing up the output :) Unless there's more control over the fancy new features now.
{
rules: 'regex',
params: {
regex: [/abc/]
}
}
or, {
rules: 'regex:^foo'
}¹http://bassistance.de/jquery-plugins/jquery-plugin-validatio...
Salid - The Simple jQuery Form Validator
http://www.jqueryin.com/projects/salid-the-simple-jquery-for...
The version I use now is tweaked with improvements. I'll gladly share it; I've just been busy and not posting much to the site. If you see problems with the validation methods, they've been fixed over the year in the new version.
I tried to add something like this to a small validation library I wrote about a year ago. I think that part worked pretty well but otherwise it wasn't very well designed. Another problem I ran into was the lack of support for rules that depended on asynchronous operations.
Check my ruby snippet for possible inspiration:
https://gist.github.com/571093 (IBAN, ISBN, ISSN, VATIN and some other numbers used in Poland)
http://vrs.tomelders.com/index.php?title=Main_Page
The hope is that one day, browsers could have a native VRS implementation, and until that day Javascript and serverside scripting could pick up the slack.