Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 KB | None | 0 0
  1.  
  2.  
  3. $(document).ready(function() {
  4. $('#contact_form').bootstrapValidator({
  5. // To use feedback icons, ensure that you use Bootstrap v3.1.0 or later
  6.  
  7.  
  8.  
  9. feedbackIcons: {
  10. valid: 'glyphicon glyphicon-ok',
  11. invalid: 'glyphicon glyphicon-remove',
  12. validating: 'glyphicon glyphicon-refresh'
  13. },
  14. fields: {
  15.  
  16. locatienaam: {validators: {stringLength: {min: 2,},notEmpty: {message: 'Vul een geldige vehuur locatie naam in.'}}},
  17. adres: {validators: {stringLength: {min: 1,},notEmpty: {message: 'Vul het volledige adres in van de verhuur locatie'}}},
  18. huisnummer: {validators: {stringLength: {min: 2,},notEmpty: {message: 'Vul het volledige adres in van de verhuur locatie'}}},
  19.  
  20.  
  21. email: {validators: {notEmpty: {message: 'Vul alsjeblieft een geldig email adres in.'},
  22. emailAddress: {message: 'Vul alsjeblieft een geldig email adres in. '}}},
  23.  
  24. telefoon: {validators: {notEmpty: {message: 'Vul alsjeblieft een geldig telefoon nummer in.'},
  25. phone: {country: 'US',message: 'Vul alsjeblieft een geldig telefoon nummer in.'}}},
  26.  
  27.  
  28. address: {
  29. validators: {
  30. stringLength: {
  31. min: 8,
  32. },
  33. notEmpty: {
  34. message: 'Please supply your street address'
  35. }
  36. }
  37. },
  38. city: {
  39. validators: {
  40. stringLength: {
  41. min: 4,
  42. },
  43. notEmpty: {
  44. message: 'Please supply your city'
  45. }
  46. }
  47. },
  48.  
  49. huisnummer: {
  50. validators: {
  51. stringLength: {
  52. min: 4,
  53. },
  54. notEmpty: {
  55. message: 'Please supply your city'
  56. }
  57. }
  58. },
  59.  
  60. //ZELF TOEGEVOEGT
  61.  
  62.  
  63.  
  64. onderwerp: {
  65. validators: {
  66. stringLength: {
  67. min: 4,
  68. },
  69. notEmpty: {
  70. message: 'Vul een duidelijk onderwerp in.'
  71. }
  72. }
  73. },
  74. bericht: {
  75. validators: {
  76. stringLength: {
  77. min: 40,
  78. },
  79. notEmpty: {
  80. message: 'Vul hier je bericht in.'
  81. }
  82. }
  83. },
  84. bestelnummer: {
  85. validators: {
  86. stringLength: {
  87. min: 10,
  88. },
  89. notEmpty: {
  90. message: 'Het bestel nummer bestaat uit 10 cijfers.'
  91. }
  92. }
  93. },
  94.  
  95.  
  96.  
  97.  
  98.  
  99. //
  100.  
  101. state: {
  102. validators: {
  103. notEmpty: {
  104. message: 'Please select your state'
  105. }
  106. }
  107. },
  108. zip: {
  109. validators: {
  110. notEmpty: {
  111. message: 'Please supply your zip code'
  112. },
  113. zipCode: {
  114. country: 'US',
  115. message: 'Please supply a vaild zip code'
  116. }
  117. }
  118. },
  119. comment: {
  120. validators: {
  121. stringLength: {
  122. min: 10,
  123. max: 200,
  124. message:'Please enter at least 10 characters and no more than 200'
  125. },
  126. notEmpty: {
  127. message: 'Please supply a description of your project'
  128. }
  129. }
  130. }
  131. }
  132. })
  133. .on('success.form.bv', function(e) {
  134. $('#success_message').slideDown({ opacity: "show" }, "slow") // Do something ...
  135. $('#contact_form').data('bootstrapValidator').resetForm();
  136.  
  137. // Prevent form submission
  138. e.preventDefault();
  139.  
  140. // Get the form instance
  141. var $form = $(e.target);
  142.  
  143. // Get the BootstrapValidator instance
  144. var bv = $form.data('bootstrapValidator');
  145.  
  146. // Use Ajax to submit form data
  147. $.post($form.attr('action'), $form.serialize(), function(result) {
  148. console.log(result);
  149. }, 'json');
  150. });
  151. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement