Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- $('#contact_form').bootstrapValidator({
- // To use feedback icons, ensure that you use Bootstrap v3.1.0 or later
- feedbackIcons: {
- valid: 'glyphicon glyphicon-ok',
- invalid: 'glyphicon glyphicon-remove',
- validating: 'glyphicon glyphicon-refresh'
- },
- fields: {
- locatienaam: {validators: {stringLength: {min: 2,},notEmpty: {message: 'Vul een geldige vehuur locatie naam in.'}}},
- adres: {validators: {stringLength: {min: 1,},notEmpty: {message: 'Vul het volledige adres in van de verhuur locatie'}}},
- huisnummer: {validators: {stringLength: {min: 2,},notEmpty: {message: 'Vul het volledige adres in van de verhuur locatie'}}},
- email: {validators: {notEmpty: {message: 'Vul alsjeblieft een geldig email adres in.'},
- emailAddress: {message: 'Vul alsjeblieft een geldig email adres in. '}}},
- telefoon: {validators: {notEmpty: {message: 'Vul alsjeblieft een geldig telefoon nummer in.'},
- phone: {country: 'US',message: 'Vul alsjeblieft een geldig telefoon nummer in.'}}},
- address: {
- validators: {
- stringLength: {
- min: 8,
- },
- notEmpty: {
- message: 'Please supply your street address'
- }
- }
- },
- city: {
- validators: {
- stringLength: {
- min: 4,
- },
- notEmpty: {
- message: 'Please supply your city'
- }
- }
- },
- huisnummer: {
- validators: {
- stringLength: {
- min: 4,
- },
- notEmpty: {
- message: 'Please supply your city'
- }
- }
- },
- //ZELF TOEGEVOEGT
- onderwerp: {
- validators: {
- stringLength: {
- min: 4,
- },
- notEmpty: {
- message: 'Vul een duidelijk onderwerp in.'
- }
- }
- },
- bericht: {
- validators: {
- stringLength: {
- min: 40,
- },
- notEmpty: {
- message: 'Vul hier je bericht in.'
- }
- }
- },
- bestelnummer: {
- validators: {
- stringLength: {
- min: 10,
- },
- notEmpty: {
- message: 'Het bestel nummer bestaat uit 10 cijfers.'
- }
- }
- },
- //
- state: {
- validators: {
- notEmpty: {
- message: 'Please select your state'
- }
- }
- },
- zip: {
- validators: {
- notEmpty: {
- message: 'Please supply your zip code'
- },
- zipCode: {
- country: 'US',
- message: 'Please supply a vaild zip code'
- }
- }
- },
- comment: {
- validators: {
- stringLength: {
- min: 10,
- max: 200,
- message:'Please enter at least 10 characters and no more than 200'
- },
- notEmpty: {
- message: 'Please supply a description of your project'
- }
- }
- }
- }
- })
- .on('success.form.bv', function(e) {
- $('#success_message').slideDown({ opacity: "show" }, "slow") // Do something ...
- $('#contact_form').data('bootstrapValidator').resetForm();
- // Prevent form submission
- e.preventDefault();
- // Get the form instance
- var $form = $(e.target);
- // Get the BootstrapValidator instance
- var bv = $form.data('bootstrapValidator');
- // Use Ajax to submit form data
- $.post($form.attr('action'), $form.serialize(), function(result) {
- console.log(result);
- }, 'json');
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement