index.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <!DOCTYPE html>
  2. <!--[if lt IE 7 ]> <html lang="en" class="ie6"> <![endif]-->
  3. <!--[if IE 7 ]> <html lang="en" class="ie7"> <![endif]-->
  4. <!--[if IE 8 ]> <html lang="en" class="ie8"> <![endif]-->
  5. <!--[if IE 9 ]> <html lang="en" class="ie9"> <![endif]-->
  6. <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->
  7. <head>
  8. <link rel="stylesheet" href="http://necolas.github.io/normalize.css/2.1.3/normalize.css">
  9. <link rel="stylesheet" href="css/jquery.idealforms.css">
  10. <meta charset=utf-8 />
  11. <title>Ideal Forms 3</title>
  12. <style>
  13. body {
  14. max-width: 980px;
  15. margin: 2em auto;
  16. font: normal 15px/1.5 Arial, sans-serif;
  17. color: #353535;
  18. overflow-y: scroll;
  19. }
  20. .content {
  21. margin: 0 30px;
  22. }
  23. .field.buttons button {
  24. margin-right: .5em;
  25. }
  26. #invalid {
  27. display: none;
  28. float: left;
  29. width: 290px;
  30. margin-left: 120px;
  31. margin-top: .5em;
  32. color: #CC2A18;
  33. font-size: 130%;
  34. font-weight: bold;
  35. }
  36. .idealforms.adaptive #invalid {
  37. margin-left: 0 !important;
  38. }
  39. .idealforms.adaptive .field.buttons label {
  40. height: 0;
  41. }
  42. </style>
  43. </head>
  44. <body>
  45. <div class="content">
  46. <div class="idealsteps-container">
  47. <nav class="idealsteps-nav"></nav>
  48. <form action="" novalidate autocomplete="off" class="idealforms">
  49. <div class="idealsteps-wrap">
  50. <!-- Step 1 -->
  51. <section class="idealsteps-step">
  52. <div class="field">
  53. <label class="main">Username:</label>
  54. <input name="username" type="text" data-idealforms-ajax="ajax.php">
  55. <span class="error"></span>
  56. </div>
  57. <div class="field">
  58. <label class="main">E-Mail:</label>
  59. <input name="email" type="email">
  60. <span class="error"></span>
  61. </div>
  62. <div class="field">
  63. <label class="main">Password:</label>
  64. <input name="password" type="password">
  65. <span class="error"></span>
  66. </div>
  67. <div class="field">
  68. <label class="main">Confirm:</label>
  69. <input name="confirmpass" type="password">
  70. <span class="error"></span>
  71. </div>
  72. <div class="field">
  73. <label class="main">Date:</label>
  74. <input name="date" type="text" placeholder="mm/dd/yyyy" class="datepicker">
  75. <span class="error"></span>
  76. </div>
  77. <div class="field">
  78. <label class="main">Picture:</label>
  79. <input id="picture" name="picture" type="file" multiple>
  80. <span class="error"></span>
  81. </div>
  82. <div class="field">
  83. <label class="main">Website:</label>
  84. <input name="website" type="text">
  85. <span class="error"></span>
  86. </div>
  87. <div class="field buttons">
  88. <label class="main">&nbsp;</label>
  89. <button type="button" class="next">Next &raquo;</button>
  90. </div>
  91. </section>
  92. <!-- Step 2 -->
  93. <section class="idealsteps-step">
  94. <div class="field">
  95. <label class="main">Sex:</label>
  96. <p class="group">
  97. <label><input name="sex" type="radio" value="male">Male</label>
  98. <label><input name="sex" type="radio" value="female">Female</label>
  99. </p>
  100. <span class="error"></span>
  101. </div>
  102. <div class="field">
  103. <label class="main">Hobbies:</label>
  104. <p class="group">
  105. <label><input name="hobbies[]" type="checkbox" value="football">Football</label>
  106. <label><input name="hobbies[]" type="checkbox" value="basketball">Basketball</label>
  107. <label><input name="hobbies[]" type="checkbox" value="dancing">Dancing</label>
  108. <label><input name="hobbies[]" type="checkbox" value="dancing">Parkour</label>
  109. <label><input name="hobbies[]" type="checkbox" value="dancing">Videogames</label>
  110. </p>
  111. <span class="error"></span>
  112. </div>
  113. <div class="field buttons">
  114. <label class="main">&nbsp;</label>
  115. <button type="button" class="prev">&laquo; Prev</button>
  116. <button type="button" class="next">Next &raquo;</button>
  117. </div>
  118. </section>
  119. <!-- Step 3 -->
  120. <section class="idealsteps-step">
  121. <div class="field">
  122. <label class="main">Phone:</label>
  123. <input name="phone" type="text" placeholder="000-000-0000">
  124. <span class="error"></span>
  125. </div>
  126. <div class="field">
  127. <label class="main">Zip:</label>
  128. <input name="zip" type="text" placeholder="00000">
  129. <span class="error"></span>
  130. </div>
  131. <div class="field">
  132. <label class="main">Options:</label>
  133. <select name="options" id="">
  134. <option value="default">&ndash; Select an option &ndash;</option>
  135. <option value="1">One</option>
  136. <option value="2">Two</option>
  137. <option value="3">Three</option>
  138. <option value="4">Four</option>
  139. </select>
  140. <span class="error"></span>
  141. </div>
  142. <div class="field">
  143. <label class="main">Comments:</label>
  144. <textarea name="comments" cols="30" rows="10"></textarea>
  145. <span class="error"></span>
  146. </div>
  147. <div class="field buttons">
  148. <label class="main">&nbsp;</label>
  149. <button type="button" class="prev">&laquo; Prev</button>
  150. <button type="submit" class="submit">Submit</button>
  151. </div>
  152. </section>
  153. </div>
  154. <span id="invalid"></span>
  155. </form>
  156. </div>
  157. </div>
  158. <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
  159. <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  160. <script src="js/out/jquery.idealforms.js"></script>
  161. <!--<script src="js/out/jquery.idealforms.min.js"></script>-->
  162. <script>
  163. $('form.idealforms').idealforms({
  164. silentLoad: false,
  165. rules: {
  166. 'username': 'required username ajax',
  167. 'email': 'required email',
  168. 'password': 'required pass',
  169. 'confirmpass': 'required equalto:password',
  170. 'date': 'required date',
  171. 'picture': 'required extension:jpg:png',
  172. 'website': 'url',
  173. 'hobbies[]': 'minoption:2 maxoption:3',
  174. 'phone': 'required phone',
  175. 'zip': 'required zip',
  176. 'options': 'select:default',
  177. },
  178. errors: {
  179. 'username': {
  180. ajaxError: 'Username not available'
  181. }
  182. },
  183. onSubmit: function(invalid, e) {
  184. e.preventDefault();
  185. $('#invalid')
  186. .show()
  187. .toggleClass('valid', ! invalid)
  188. .text(invalid ? (invalid +' invalid fields') : 'All good!');
  189. }
  190. });
  191. $('form.idealforms').find('input, select, textarea').on('change keyup', function() {
  192. $('#invalid').hide();
  193. });
  194. $('form.idealforms').idealforms('addRules', {
  195. 'comments': 'required minmax:50:200'
  196. });
  197. $('.prev').click(function(){
  198. $('.prev').show();
  199. $('form.idealforms').idealforms('prevStep');
  200. });
  201. $('.next').click(function(){
  202. $('.next').show();
  203. $('form.idealforms').idealforms('nextStep');
  204. });
  205. </script>
  206. </body>
  207. </html>