Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 1.40 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <script type="text/javascript">
  2.  
  3.  jQuery(document).ready(function() {   
  4.     if(jQuery('.add-gf-sections').length) {
  5.                 jQuery('.button').attr("id", 'submitbutton');
  6.         var theform         = '.gform_body';
  7.         var formid          = jQuery('ul.gform_fields').attr('id');
  8.         var sections        = new Array;
  9.                 var legends         = new Array; //Added by me
  10.         var sections_html   = '';
  11.         var c               = 0;
  12.  
  13.         jQuery(theform + ' li').each(function(i,elem){
  14.             if(jQuery(elem).hasClass('gsection')) {                            
  15.                 c++;
  16.                                 legends[c] = jQuery(this).text();
  17.                 sections[c] = jQuery('<div>').append(jQuery(elem).clone()).remove().html();
  18.             } else {                                   
  19.                 content = jQuery('<div>').append(jQuery(elem).clone()).remove().html();
  20.                 sections[c] += content;
  21.             }
  22.         });
  23.  
  24.         for(i = 1; i < sections.length; i++) {
  25.             sections_html += '<fieldset class="gsection-container"><legend>' + legends[i] + '</legend><ul id="' + formid + '_' + i + '">' + sections[i] + '</ul></fieldset>'; //Modifed by me
  26.         }
  27.                 sections_html = "<input type='hidden' class='gform_hidden' name='is_submit_1' value='1'>" + sections_html; //Added by me
  28.                
  29.         jQuery(theform).html(sections_html);
  30.                 jQuery("#gform_1").formToWizard({ submitButton: 'submitbutton' });
  31.                
  32.     }
  33.        
  34. });
  35.  
  36. </script>