Having JS sanitize for the backend is somewhat dubious, I'd not go there, but you probably don't want to discuss that.
Anyway, a validation method has access to the validate element, so you could as well write a method that just sanitizes, nothing else. Combine that with a strict validation method, ala: rules: { ssnfield: { required: true ssncleaner: true, ssn: ssn } } No change to required needed. ssncleaner would always return true, and change the input value; ssn would just validate a strict ssn. A very simple and general sanitizer would just trim whitespace - the plugin did that in earlier versions, but that wasn't desired in general: $.validator.addMethod("trim", function(value, element) { element.value = $.trim(value); return true; }); That seems to be quite flexible to me. Jörn On Mon, Jul 27, 2009 at 11:28 PM, Brett Ritter<swift...@swiftone.org> wrote: > > On Mon, Jul 27, 2009 at 5:20 PM, Jörn > Zaefferer<joern.zaeffe...@googlemail.com> wrote: >> You could start by writing custom methods for each of these input >> types, and where possible, delegate to the existing methods: >> http://docs.jquery.com/Plugins/Validation/Validator/addMethod > > If I'm following you, you're saying to have validation that accepts > the "loose" input and considers them all "valid". That doesn't help > me sanitize for the backend though. > On submission, that Phone number should come across as the "proper" > format. This also complicates the validation methods considerably. > > Or am I misunderstanding you? > > -- > Brett Ritter / SwiftOne > swift...@swiftone.org >