Sha256: ca3e6679fb89957b52ad3293ed5d8f6701a361715705e44b45706fc5ed583883
Contents?: true
Size: 1.81 KB
Versions: 1
Compression:
Stored size: 1.81 KB
Contents
$(function () { $('#form_validation').validate({ rules: { 'checkbox': { required: true }, 'gender': { required: true } }, highlight: function (input) { $(input).parents('.form-line').addClass('error'); }, unhighlight: function (input) { $(input).parents('.form-line').removeClass('error'); }, errorPlacement: function (error, element) { $(element).parents('.form-group').append(error); } }); //Advanced Form Validation $('#form_advanced_validation').validate({ rules: { 'date': { customdate: true }, 'creditcard': { creditcard: true } }, highlight: function (input) { $(input).parents('.form-line').addClass('error'); }, unhighlight: function (input) { $(input).parents('.form-line').removeClass('error'); }, errorPlacement: function (error, element) { $(element).parents('.form-group').append(error); } }); //Custom Validations =============================================================================== //Date $.validator.addMethod('customdate', function (value, element) { return value.match(/^\d\d\d\d?-\d\d?-\d\d$/); }, 'Please enter a date in the format YYYY-MM-DD.' ); //Credit card $.validator.addMethod('creditcard', function (value, element) { return value.match(/^\d\d\d\d?-\d\d\d\d?-\d\d\d\d?-\d\d\d\d$/); }, 'Please enter a credit card in the format XXXX-XXXX-XXXX-XXXX.' ); //================================================================================================== });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jinda_bsb-0.0.1 | lib/generators/jinda_bsb/templates/app/assets/jinda_assets/js/pages/forms/form-validation.js |