form_wizard.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>H+ 后台主题UI框架 - 表单向导</title>
  7. <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
  8. <meta name="description" content="H+是一个完全响应式,基于Bootstrap3最新版本开发的扁平化主题,她采用了主流的左右两栏式布局,使用了Html5+CSS3等现代技术">
  9. <link rel="shortcut icon" href="favicon.ico"> <link href="css/bootstrap.min.css?v=3.3.7" rel="stylesheet">
  10. <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
  11. <link href="css/plugins/iCheck/custom.css" rel="stylesheet">
  12. <link href="css/plugins/steps/jquery.steps.css" rel="stylesheet">
  13. <link href="css/animate.css" rel="stylesheet">
  14. <link href="css/style.css?v=4.1.0" rel="stylesheet">
  15. </head>
  16. <body class="gray-bg">
  17. <div class="wrapper wrapper-content animated fadeInRight">
  18. <div class="row">
  19. <div class="col-sm-5">
  20. <div class="jumbotron">
  21. <h1>表单向导</h1>
  22. <p>Smart UI 部件允许您快速创建表单向导接口。</p>
  23. <p><a href="http://www.jquery-steps.com/GettingStarted" target="_blank" class="btn btn-primary btn-lg" role="button">了解 jQuery Steps</a>
  24. </p>
  25. </div>
  26. </div>
  27. <div class="col-sm-7">
  28. <div class="ibox float-e-margins">
  29. <div class="ibox-title">
  30. <h5>基础表单向导</h5>
  31. <div class="ibox-tools">
  32. <a class="collapse-link">
  33. <i class="fa fa-chevron-up"></i>
  34. </a>
  35. <a class="dropdown-toggle" data-toggle="dropdown" href="form_wizard.html#">
  36. <i class="fa fa-wrench"></i>
  37. </a>
  38. <ul class="dropdown-menu dropdown-user">
  39. <li><a href="form_wizard.html#">选项1</a>
  40. </li>
  41. <li><a href="form_wizard.html#">选项2</a>
  42. </li>
  43. </ul>
  44. <a class="close-link">
  45. <i class="fa fa-times"></i>
  46. </a>
  47. </div>
  48. </div>
  49. <div class="ibox-content">
  50. <p>
  51. 这是一个简单的表单向导示例
  52. </p>
  53. <div id="wizard">
  54. <h1>第一步</h1>
  55. <div class="step-content">
  56. <div class="text-center m-t-md">
  57. <h2>第一步</h2>
  58. <p>
  59. 这是第一步的内容
  60. </p>
  61. </div>
  62. </div>
  63. <h1>第二步</h1>
  64. <div class="step-content">
  65. <div class="text-center m-t-md">
  66. <h2>第二步</h2>
  67. <p>
  68. 这是第二步的内容
  69. </p>
  70. </div>
  71. </div>
  72. <h1>第三步</h1>
  73. <div class="step-content">
  74. <div class="text-center m-t-md">
  75. <h2>第三步</h2>
  76. <p>
  77. 这是第三步的内容
  78. </p>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="row">
  87. <div class="col-sm-12">
  88. <div class="ibox">
  89. <div class="ibox-title">
  90. <h5>带验证的表单向导</h5>
  91. <div class="ibox-tools">
  92. <a class="collapse-link">
  93. <i class="fa fa-chevron-up"></i>
  94. </a>
  95. <a class="dropdown-toggle" data-toggle="dropdown" href="form_wizard.html#">
  96. <i class="fa fa-wrench"></i>
  97. </a>
  98. <ul class="dropdown-menu dropdown-user">
  99. <li><a href="form_wizard.html#">选项1</a>
  100. </li>
  101. <li><a href="form_wizard.html#">选项2</a>
  102. </li>
  103. </ul>
  104. <a class="close-link">
  105. <i class="fa fa-times"></i>
  106. </a>
  107. </div>
  108. </div>
  109. <div class="ibox-content">
  110. <h2>
  111. 带验证的表单向导
  112. </h2>
  113. <p>
  114. 下面这个示例展示了如何在表单向导中使用 jQuery Validation 插件
  115. </p>
  116. <form id="form" action="form_wizard.html#" class="wizard-big">
  117. <h1>账户</h1>
  118. <fieldset>
  119. <h2>账户信息</h2>
  120. <div class="row">
  121. <div class="col-sm-8">
  122. <div class="form-group">
  123. <label>用户名 *</label>
  124. <input id="userName" name="userName" type="text" class="form-control required">
  125. </div>
  126. <div class="form-group">
  127. <label>密码 *</label>
  128. <input id="password" name="password" type="text" class="form-control required">
  129. </div>
  130. <div class="form-group">
  131. <label>确认密码 *</label>
  132. <input id="confirm" name="confirm" type="text" class="form-control required">
  133. </div>
  134. </div>
  135. <div class="col-sm-4">
  136. <div class="text-center">
  137. <div style="margin-top: 20px">
  138. <i class="fa fa-sign-in" style="font-size: 180px;color: #e5e5e5 "></i>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </fieldset>
  144. <h1>个人资料</h1>
  145. <fieldset>
  146. <h2>个人资料信息</h2>
  147. <div class="row">
  148. <div class="col-sm-6">
  149. <div class="form-group">
  150. <label>姓名 *</label>
  151. <input id="name" name="name" type="text" class="form-control required">
  152. </div>
  153. </div>
  154. <div class="col-sm-6">
  155. <div class="form-group">
  156. <label>Email *</label>
  157. <input id="email" name="email" type="text" class="form-control required email">
  158. </div>
  159. <div class="form-group">
  160. <label>地址 *</label>
  161. <input id="address" name="address" type="text" class="form-control">
  162. </div>
  163. </div>
  164. </div>
  165. </fieldset>
  166. <h1>警告</h1>
  167. <fieldset>
  168. <div class="text-center" style="margin-top: 120px">
  169. <h2>你是火星人 :-)</h2>
  170. </div>
  171. </fieldset>
  172. <h1>完成</h1>
  173. <fieldset>
  174. <h2>条款</h2>
  175. <input id="acceptTerms" name="acceptTerms" type="checkbox" class="required">
  176. <label for="acceptTerms">我同意注册条款</label>
  177. </fieldset>
  178. </form>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. <!-- 全局js -->
  185. <script src="js/jquery.min.js?v=2.1.4"></script>
  186. <script src="js/bootstrap.min.js?v=3.3.7"></script>
  187. <!-- 自定义js -->
  188. <script src="js/content.js?v=1.0.0"></script>
  189. <!-- Steps -->
  190. <script src="js/plugins/staps/jquery.steps.min.js"></script>
  191. <!-- Jquery Validate -->
  192. <script src="js/plugins/validate/jquery.validate.min.js"></script>
  193. <script src="js/plugins/validate/messages_zh.min.js"></script>
  194. <script>
  195. $(document).ready(function () {
  196. $("#wizard").steps();
  197. $("#form").steps({
  198. bodyTag: "fieldset",
  199. onStepChanging: function (event, currentIndex, newIndex) {
  200. // Always allow going backward even if the current step contains invalid fields!
  201. if (currentIndex > newIndex) {
  202. return true;
  203. }
  204. // Forbid suppressing "Warning" step if the user is to young
  205. if (newIndex === 3 && Number($("#age").val()) < 18) {
  206. return false;
  207. }
  208. var form = $(this);
  209. // Clean up if user went backward before
  210. if (currentIndex < newIndex) {
  211. // To remove error styles
  212. $(".body:eq(" + newIndex + ") label.error", form).remove();
  213. $(".body:eq(" + newIndex + ") .error", form).removeClass("error");
  214. }
  215. // Disable validation on fields that are disabled or hidden.
  216. form.validate().settings.ignore = ":disabled,:hidden";
  217. // Start validation; Prevent going forward if false
  218. return form.valid();
  219. },
  220. onStepChanged: function (event, currentIndex, priorIndex) {
  221. // Suppress (skip) "Warning" step if the user is old enough.
  222. if (currentIndex === 2 && Number($("#age").val()) >= 18) {
  223. $(this).steps("next");
  224. }
  225. // Suppress (skip) "Warning" step if the user is old enough and wants to the previous step.
  226. if (currentIndex === 2 && priorIndex === 3) {
  227. $(this).steps("previous");
  228. }
  229. },
  230. onFinishing: function (event, currentIndex) {
  231. var form = $(this);
  232. // Disable validation on fields that are disabled.
  233. // At this point it's recommended to do an overall check (mean ignoring only disabled fields)
  234. form.validate().settings.ignore = ":disabled";
  235. // Start validation; Prevent form submission if false
  236. return form.valid();
  237. },
  238. onFinished: function (event, currentIndex) {
  239. var form = $(this);
  240. // Submit form input
  241. form.submit();
  242. }
  243. }).validate({
  244. errorPlacement: function (error, element) {
  245. element.before(error);
  246. },
  247. rules: {
  248. confirm: {
  249. equalTo: "#password"
  250. }
  251. }
  252. });
  253. });
  254. </script>
  255. <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
  256. <!--统计代码,可删除-->
  257. </body>
  258. </html>