Advertisement
Guest User

Untitled

a guest
May 31st, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. <div class="row">
  2. <div class="col-md-6">
  3. <div class="form-group">
  4. <label> <span>Amount to Player</span></label>
  5. <input name="AmountToHorse" type="text" class="form-control">
  6. </div>
  7. </div>
  8. <div class="col-md-6">
  9. <div class="form-group">
  10. <label> <span>Amount to Stable</span></label>
  11. <input name="AmountToStable" type="text" class="form-control">
  12. </div>
  13. </div>
  14. </div>
  15.  
  16. $('#reloadForm').validate({
  17. rules: {
  18.  
  19. AmountToHorse: {
  20. required: true,
  21. number: true
  22. },
  23. AmountToStable: {
  24. required: true,
  25. number: true
  26. },
  27. }
  28. });
  29.  
  30. $(document).ready(function () {
  31.  
  32. $.validator.addMethod('onlyOne', function(value, element, param) {
  33. return this.optional(element) || $('[name="' + param[0] + '"]').is(':blank');
  34. }, "Please fill out only one of these fields");
  35.  
  36. $('#myform').validate({
  37. rules: {
  38. foo: {
  39. onlyOne: ["bar"]
  40. },
  41. bar: {
  42. onlyOne: ["foo"]
  43. }
  44. }
  45. });
  46.  
  47. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement