I’m looking for a library that will do some pre-validation functions on my input fields.
For example, when you logging into hotmail, the user’s email address is automatically lowercased before the form is submitted.
I want to be able to strip out all none-alphanumeric characters from certain fields, upper/lowercase some input, strip out spaces etc.
Does anyone know of such a library before I go ahead and write all this stuff manually?
I think the terminology you’re looking for is input mask. Wikipedia describes them like so:
You should check out the jQuery Masked Input plugin.
http://digitalbush.com/projects/masked-input-plugin/
It has several predefined options, but allows you to create custom “input masks” that will meet your needs. You may need to write some custom jQuery code using the .change() and/or .blur() events in addition to input masking (depending on the complexity of your needs).