/[drupal]/contributions/docs/developer/examples/multipage_form_example.module
ViewVC logotype

Diff of /contributions/docs/developer/examples/multipage_form_example.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.6, Sun Apr 2 19:02:55 2006 UTC revision 1.7, Sun Apr 2 19:23:47 2006 UTC
# Line 1  Line 1 
1  <?php  <?php
2    
3  // $Id: multipage_form_example.module,v 1.5 2006/03/30 04:32:53 drumm Exp $  // $Id: multipage_form_example.module,v 1.6 2006/04/02 19:02:55 thehunmonkgroup Exp $
4    
5  /**  /**
6   * Implementation of hook_help().   * Implementation of hook_help().
# Line 266  function multipage_form_example_pre_rend Line 266  function multipage_form_example_pre_rend
266      multipage_form_set_element_visibility($form['person'],                    in_array($form['page']['#value'], array(2)));      multipage_form_set_element_visibility($form['person'],                    in_array($form['page']['#value'], array(2)));
267      multipage_form_set_element_visibility($form['person']['fav_person'],      in_array($form['page']['#value'], array(2)));      multipage_form_set_element_visibility($form['person']['fav_person'],      in_array($form['page']['#value'], array(2)));
268      multipage_form_set_element_visibility($form['person']['fav_person_desc'], in_array($form['page']['#value'], array(2)));      multipage_form_set_element_visibility($form['person']['fav_person_desc'], in_array($form['page']['#value'], array(2)));
269      multipage_form_set_element_visibility($form['person']['fav_gummi'],       in_array($form['page']['#value'], array(2)));      multipage_form_set_element_visibility($form['person']['fav_gummi'],       in_array($form['page']['#value'], array(2)), $next_page);
270    
271      // Color and number, page 3      // Color and number, page 3
272      multipage_form_set_element_visibility($form['fav_color'],                 in_array($form['page']['#value'], array(3)));      multipage_form_set_element_visibility($form['fav_color'],                 in_array($form['page']['#value'], array(3)));
# Line 384  function theme_multipage_form_example($n Line 384  function theme_multipage_form_example($n
384   *   The form element array to modify.   *   The form element array to modify.
385   * @param $visible   * @param $visible
386   *   The desired visibity of the form element.   *   The desired visibity of the form element.
387     * @param $next_page
388     *   Boolean value, TRUE if the next page is about to be rendered, FALSE otherwise.
389   */   */
390  function multipage_form_set_element_visibility(&$element, $visible) {  function multipage_form_set_element_visibility(&$element, $visible, $next_page = TRUE) {
391    multipage_form_restore_attributes($element);    multipage_form_restore_attributes($element);
392    if (!$visible) {    if (!$visible) {
393      switch ($element['#type']) {      switch ($element['#type']) {
# Line 399  function multipage_form_set_element_visi Line 401  function multipage_form_set_element_visi
401    
402        case 'radio':        case 'radio':
403        case 'checkbox':        case 'checkbox':
404          multipage_form_set_attribute($element, '#type', 'hidden');  
405            // We can't change these to hidden until right before the next page is rendered, otherwise
406            // the value is lost sometimes.
407            if ($next_page) {
408              multipage_form_set_attribute($element, '#type', 'hidden');
409            }
410          break;          break;
411    
412        case 'fieldset':        case 'fieldset':

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.2