abstractindia

jquery-steps store form data to session

Nov 12th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.91 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Multi-step form</title>
  6.  
  7. <link href="css/bootstrap.css" rel="stylesheet" type="text/css">
  8. <link rel="stylesheet" type="text/css" href="css/font-awesome.css">
  9. <link rel="stylesheet" type="text/css" href="css/jquery.steps.css">
  10. <script src="js/modernizr-2.6.2.min.js"></script>
  11. <script src="js/jquery.min.js"></script>
  12. <script src="js/bootstrap.min.js"></script>
  13. <script src="js/jquery.cookie-1.3.1.js"></script>
  14. <script src="js/jquery.steps.js"></script>
  15.    
  16. <script>
  17. // Tries to load the saved state (step position)
  18. if (options.saveState && $.cookie)
  19. {
  20.     var savedState = $.cookie(_cookiePrefix + getUniqueId(wizard));
  21.     // Sets the saved position to the start index if not undefined or out of range
  22.     var savedIndex = parseInt(savedState, 0);
  23.     if (!isNaN(savedIndex) && savedIndex < state.stepCount)
  24.     {
  25.         startIndex = savedIndex;
  26.     }
  27. }
  28. </script>
  29.  
  30. </head>
  31. <body>
  32. <div class="container">      
  33. <div class="row">
  34.     <div id="maincontent" class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  35.         <div class="row">
  36.             <div id="" class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  37.                 <form id="multiphase" role="form" class="form-horizontal" action="" method="post">
  38.                 <input name="globalstudentid" id="globalstudentid" type="hidden" value="<?php $_GET['StudentID']; ?>">
  39.                 <h2>Step</h2>
  40.                 <section data-step="0">
  41.                     <h2>Terms and Conditions:</h2>
  42.                     <p>Some terms and conditions text here.</p>
  43.                      
  44.                       <input name="accept_terms" type="checkbox" value="" />
  45.                       <label>I Accept the Terms and Conditions</label>
  46.  
  47.                 </section>
  48.                 <h2>Step</h2>
  49.                 <section data-step="0">
  50.                     <h2>Students Personal Details:</h2>
  51.                       <label>First Name:</label>
  52.                       <input name="firstname" type="text" value="" /><br />
  53.                      
  54.                       <label>Last Name:</label>
  55.                       <input name="lastname" type="text" value="" />
  56.  
  57.                 </section>
  58.                 <h2>Step</h2>
  59.                 <section data-step="1">
  60.                     <h2>College Details:</h2>
  61.                       <label>College Name:</label>
  62.                       <input name="collegename" type="text" value="" /><br />
  63.                      
  64.                       <label>College Address:</label>
  65.                       <input name="collegename" type="text" value="" />
  66.  
  67.                 </section>
  68.                 <h2>Step</h2>
  69.                 <section data-step="2">
  70.                     <h2>Course Details:</h2>
  71.                       <label>Course Name:</label>
  72.                       <input name="coursename" type="text" value="" /><br />
  73.                      
  74.                       <label>Course Duration:</label>
  75.                       <input name="courseduration" type="text" value="" />
  76.  
  77.                 </section>
  78.                 </form>
  79.  
  80.             </div>
  81.         </div>
  82.     </div>
  83. </div>
  84. </div>
  85. <script type="text/javascript">
  86.   $(document).ready(function() {
  87.       function adjustIframeHeight() {
  88.         var $body   = $('body'),
  89.             $iframe = $body.data('iframe.fv');
  90.         if ($iframe) {
  91.             // Adjust the height of iframe
  92.             $iframe.height($body.height());
  93.         }
  94.       }
  95.       $("#multiphase").steps({
  96.             headerTag: "h2",
  97.             bodyTag: "section",
  98.             saveState: true,
  99.             transitionEffect:1,
  100.             transitionEffectSpeed: 200,
  101.             enableContentCache: true,
  102.             onStepChanged: function(e, currentIndex, priorIndex) {
  103.                 adjustIframeHeight();
  104.             },         
  105.       });
  106.    
  107. });
  108.  
  109. </script>
  110.  
  111. </body>
  112. </html>
Advertisement
Add Comment
Please, Sign In to add comment