-
Notifications
You must be signed in to change notification settings - Fork 471
Fixed issue with Leap Years #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added Google CDN Hosted jQuery latest
29/02/2012 was a Leap Year, but was being shown as an incorrect Date
Also changed minified version and changed to not alter Symbols
UK VAT Number Validation added
I have also fixed the minified version which had shorted the variables causing various issues. Later commit includes validation for UK VAT Number Validation. I have tested US Date Format: mm/dd/yyyy which is fine, and European: dd.mm.yyyy and UK Format: dd/mm/yyyy which are all fine (except the Leap Year issue which is also fixed in this Pull Request) |
No I don't mind - Keep up the great work! Maybe I will rethink the design of the plugin later on. Both validateSwedishMobileNumber, validateSwedishSecurityNumber and validateUKVATNumber feels like very specific functions. Maybe there should be some sort of modular design. I my self is using the plugin on some mobile websites. The smaller the files is the better in that case... A module could look something like: jQueryFormUtil.addValidator({
name : 'validateUKVATNumber',
validate : function(val) {...},
errorMessage : '....'
}); Im thinking that each module, or set of modules, could be lying in its own file, in the same directory as the jquery form validation plugin. And that you could load them like: jQueryFormUtil.loadModules('validateUKVATNumber, otherValidationLibrary'); The module loading function will itself create and append the script tag and wait for it to load until calls to $(this).validate() becomes possible. Im guessing this will be version 2.0 of the plugin :) Once again thank you for the collaboration and the nice code contribution! |
Fixed issue with Leap Years
+1 for the modular design idea! This would massively save on resources for Mobile/Low Bandwidth users (especially as I wouldn't need say the Swedish validation, where you wouldn't need UK etc). I was just thinking of "localised" validation (i.e. en_GB, en_US, se etc), but it seems silly to design it like this as somebody may not need (for example) URL or Domain so it seems silly them downloading these for nothing. |
I was thinking that the most commonly used functions would be part of the core and that the rest would be distributed as modules. Possibly keeping these functions as default:
What do you think? |
That sounds good to me! Need to look at how we can load external js files in the most compatible way... I know that Modernizer etc just created a build page which created a JS file for the user on request which was a minified version with just the functionality they want... but this isn't easily extendable in the future... |
We could use something like Google Analytics Async load:
|
Maybe it's better to use the jQuery's function getScript? Something like: loadModule = function(modules, path) {
if(!path) {
var path = // get relative path of current script file
}
$.each(modules.split(','), function(i, module) {
$.getScript( path + $.trim(module) + '.js' )
.fail(function() {
throw new Error('Unable to load form validation module '+module);
});
});
}
....
jQueryFormUtils.loadModules('date,ukvatnumber,something'); |
That could work! Are you going to implement, or would you like me to have a go? |
Give me until tomorrow. I will push it to a separate banch. |
Sweeet :) |
29/02/2012 which is a Leap Year (and therefore has 29 days in the month of Febrary) was being shown as an incorrect Date.
This has been resolved in my latest commit (along with the jQuery Library missing, and therefore the examle.html file doesn't instantly work (I have linked to Google CDN to include this so new downloaders can use straight away to evaluate).
I hope you don't mind me doing all these changes, I just love the library, and want to get this to a position where I can use in some new projects I am working on :) :)