/public/javascripts/jQuery-validationEngine-2.6.1/demos/demoPositioning.html

https://bitbucket.org/hamidrezas/melobit · HTML · 130 lines · 118 code · 12 blank · 0 comment · 0 complexity · 7aca5b506dcdfa48b6f8cb9a249f2f6b MD5 · raw file

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  5. <title>JQuery Validation Engine</title>
  6. <link rel="stylesheet" href="../css/validationEngine.jquery.css" type="text/css"/>
  7. <link rel="stylesheet" href="../css/template.css" type="text/css"/>
  8. <script src="../js/jquery-1.6.min.js" type="text/javascript">
  9. </script>
  10. <script src="../js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8">
  11. </script>
  12. <script src="../js/jquery.validationEngine.js" type="text/javascript" charset="utf-8">
  13. </script>
  14. <script>
  15. //$.validationEngine.defaults.scroll = false;
  16. jQuery(document).ready(function(){
  17. // binds form submission and fields to the validation engine
  18. jQuery("#formID").validationEngine('attach');
  19. //jQuery("#formID").validationEngine('attach',{ isOverflown: true });
  20. //jQuery("#formID").validationEngine('attach',{ relative: true });
  21. });
  22. /**
  23. *
  24. * @param {jqObject} the field where the validation applies
  25. * @param {Array[String]} validation rules for this field
  26. * @param {int} rule index
  27. * @param {Map} form options
  28. * @return an error string if validation failed
  29. */
  30. function checkHELLO(field, rules, i, options){
  31. if (field.val() != "HELLO") {
  32. // this allows to use i18 for the error msgs
  33. return options.allrules.validate2fields.alertText;
  34. }
  35. }
  36. function changeposition(wo) {
  37. jQuery('#formID').validationEngine('hide');
  38. jQuery('input').attr('data-prompt-position',wo);
  39. jQuery('input').data('promptPosition',wo);
  40. jQuery('textarea').attr('data-prompt-position',wo);
  41. jQuery('textarea').data('promptPosition',wo);
  42. jQuery('select').attr('data-prompt-position',wo);
  43. jQuery('select').data('promptPosition',wo);
  44. }
  45. function changemethod(welche) {
  46. jQuery('#formID').validationEngine('hide');
  47. jQuery("#formID").validationEngine('detach');
  48. jQuery("#formID").validationEngine('attach');
  49. }
  50. </script>
  51. <style>
  52. /* fix overly wacky stylesheet */
  53. input {
  54. display: inline !important;
  55. }
  56. </style>
  57. </head>
  58. <body>
  59. <p>
  60. <a href="#" onclick="jQuery('#formID').validationEngine('validate')">Evaluate form</a>
  61. | <a href="#" onclick="jQuery('#formID').validationEngine('hide')">Close all prompts on form</a>
  62. <br> <a href="#" onclick="changeposition('topRight')">TopRight</a>
  63. | <a href="#" onclick="changeposition('topLeft')">TopLeft</a>
  64. | <a href="#" onclick="changeposition('bottomRight')">BottomRight</a>
  65. | <a href="#" onclick="changeposition('bottomLeft')">BottomLeft</a>
  66. | <a href="#" onclick="changeposition('centerRight')">CenterRight</a>
  67. | <a href="#" onclick="changeposition('centerLeft')">CenterLeft</a>
  68. <br>
  69. <a href="#" style="float:left" onclick="jQuery('body').attr('dir','ltr')">Left to Right</a>
  70. <a href="#" style="float:right" onclick="jQuery('body').attr('dir','rtl')">Right to Left</a>
  71. <br> <a href="../index.html" >Back to index</a>
  72. </p>
  73. <p>
  74. This demonstration shows positioning
  75. <br/>
  76. </p>
  77. <div style="height:500px;overflow-y:scroll;">
  78. <div style="height:1000px;">
  79. <form id="formID" class="formular" method="post" action="" style="position:relative;">
  80. <fieldset>
  81. <legend>
  82. </legend>
  83. <label>
  84. Field is required :
  85. </label>
  86. <input value="" class="validate[required] text-input" type="text" name="req" id="req" />
  87. <label>Favorite sport 1:</label>
  88. <select name="sport" id="sport" class="validate[required]">
  89. <option value="">Choose a sport</option>
  90. <option value="option1">Tennis</option>
  91. <option value="option2">Football</option>
  92. <option value="option3">Golf</option>
  93. </select>
  94. <label>Favorite sport 2:</label>
  95. <select name="sport2" id="sport2" multiple class="validate[required]">
  96. <option value="">Choose a sport</option>
  97. <option value="option1"><l i>Tennis</li></option>
  98. <option value="option2">Football</option>
  99. <option value="option3">Golf</option>
  100. </select>
  101. <label>Additional info:</label>
  102. <textarea class="validate[required]" id="add" style="width:250px;height:50px;"></textarea>
  103. <label>Radio Group: </label>
  104. <div>radio 1:
  105. <input class="validate[required] radio" type="radio" name="group0" id="radio1" value="5"/></div>
  106. <div>radio 2:
  107. <input class="validate[required] radio" type="radio" name="group0" id="radio2" value="3"/></div>
  108. <div>radio 3:
  109. <input class="validate[required] radio" type="radio" name="group0" id="radio3" value="9"/></div>
  110. <label>I accept terms of use : </label>
  111. <input class="validate[required] checkbox" type="checkbox" id="agree" name="agree"/>
  112. </fieldset>
  113. <input class="submit" type="submit" value="Validate &amp; Send the form!"/><hr/>
  114. </form>
  115. </div>
  116. </div>
  117. </body>
  118. </html>