/* * mailinglistpopupreminder-validation.js * * validation rules for the mailing list popup * * * fValidate( $nStep ) */ !function($, undefined) { window.fInitValidation = function( $elem ) { window.validator = $elem.validate({ rules: { sMailingListName: { required: true }, sMailingListEmail: { required: true, email: true } }, messages: { } }); }; // expose the fValidate function to global js scope window.fValidate = function( $elem ) { fInitValidation( $elem ); var $context = $elem; var $valid = true; $(':input', $context).each(function(index, element) { $valid = validator.element(element) && $valid; }); if ( ! $valid ) { return false; } return true; }; }(jQuery);