option-timely.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Timely</title>
  6. <link rel="stylesheet" href="demo.css">
  7. </head>
  8. <body>
  9. <form class="form" data-validator-option="{timely:0}">
  10. <h3>timely: 0 <span class="note">(only validation on submit)</span></h3>
  11. <div class="form-item">
  12. <input type="text" name="user[email]" data-rule="required;email" placeholder="Email">
  13. </div>
  14. <div class="form-item">
  15. <button type="submit">Submit</button>
  16. </div>
  17. </form>
  18. <form class="form" data-validator-option="{timely:1, focusCleanup:true}">
  19. <h3>timely: 1 <span class="note">(default, validation on blur)</span></h3>
  20. <div class="form-item">
  21. <input type="text" name="user[email]" data-rule="required;email" placeholder="Email">
  22. </div>
  23. <div class="form-item">
  24. <button type="submit">Submit</button>
  25. </div>
  26. </form>
  27. <form class="form" data-validator-option="{timely:2, focusCleanup:true}">
  28. <h3>timely: 2 <span class="note">(validation on input)</span></h3>
  29. <div class="form-item">
  30. <input type="text" name="user[email]" data-rule="required;email" placeholder="Email">
  31. </div>
  32. <div class="form-item">
  33. <button type="submit">Submit</button>
  34. </div>
  35. </form>
  36. <form class="form" data-validator-option="{timely:3, focusCleanup:true}">
  37. <h3>timely: 3 <span class="note">(validation on input and blur)</span></h3>
  38. <p>Unlike "timely:2", when focusout an empty field.</p>
  39. <div class="form-item">
  40. <input type="text" name="user[email]"
  41. data-rule="required;email"
  42. data-tip="Please fill a email." placeholder="Email">
  43. </div>
  44. <div class="form-item">
  45. <button type="submit">Submit</button>
  46. </div>
  47. </form>
  48. <form class="form" data-validator-option="{timely:8, focusCleanup:true, theme:'yellow_right'}">
  49. <h3>timely: 8 <span class="note">(validation on input, show every rule message)</span></h3>
  50. <div class="form-item">
  51. <input type="text" name="user[email]" data-rule="required;email" placeholder="Email">
  52. </div>
  53. <div class="form-item">
  54. <button type="submit">Submit</button>
  55. </div>
  56. </form>
  57. <form class="form" data-validator-option="{timely:9, focusCleanup:true, theme:'yellow_right'}">
  58. <h3>timely: 9 <span class="note">(validation on input and blur, show every rule message)</span></h3>
  59. <p>Unlike "timely:8", when focusout an empty field.</p>
  60. <div class="form-item">
  61. <input type="text" name="user[email]" data-rule="required;email" placeholder="Email">
  62. </div>
  63. <div class="form-item">
  64. <button type="submit">Submit</button>
  65. </div>
  66. </form>
  67. <form class="form" data-validator-option="{focusCleanup:true, theme:'yellow_right'}">
  68. <h3>Set different timely value in one form</h3>
  69. <div class="form-item">
  70. <input type="text" name="field0" data-rule="required;length(6~)" data-timely="0" placeholder="timely:0, submit">
  71. </div>
  72. <div class="form-item">
  73. <input type="text" name="field1" data-rule="required;length(6~)" data-timely="1" placeholder="timely:1, submit / focusout" data-ok="">
  74. </div>
  75. <div class="form-item">
  76. <input type="text" name="field2" data-rule="required;length(6~)" data-timely="2" placeholder="timely:2, submit / input" data-tip="Just a test!">
  77. </div>
  78. <div class="form-item">
  79. <input type="text" name="field3" data-rule="required;length(6~)" data-timely="3" placeholder="timely:3, submit / input / focusout">
  80. </div>
  81. <div class="form-item">
  82. <input type="text" name="field8" data-rule="required;length(6~)" data-timely="8" placeholder="timely:8, submit / input">
  83. </div>
  84. <div class="form-item">
  85. <input type="text" name="field9" data-rule="required;length(6~)" data-timely="9" placeholder="timely:9, submit / input / focusout">
  86. </div>
  87. <div class="form-item">
  88. <button type="submit">Submit</button>
  89. </div>
  90. </form>
  91. <script src="https://cdn.jsdelivr.net/jquery/1.12.3/jquery.min.js"></script>
  92. <script src="../dist/jquery.validator.js?local=en"></script>
  93. </body>
  94. </html>