Fix for drupal_render clearing default_value ... huh?

xurizaemon's picture
  1. function augforms_wall_invite_email_form($form_id, &$form_state = NULL) {
  2.   $num_invites = 5 ;
  3.   for ( $i = 0 ; $i < $num_invites ; $i++ ) {
  4.     $row = array() ;
  5.     $form['invite_name_'.$i] = array(
  6.       '#default_value' => t('Friend !i Name', array( '!i' => $i )),
  7.       '#title' => '',
  8.       '#type' => 'textfield',
  9.       '#attributes' => array(
  10.         'class' => 'augforms-clear-on-focus',
  11.       ),
  12.     ) ;
  13.     $form['invite_email_'.$i] = array(
  14.       '#default_value' => t('Friend !i Email', array( '!i' => $i )),
  15.       '#title' => '',
  16.       '#type' => 'textfield',
  17.       '#attributes' => array(
  18.         'class' => 'augforms-clear-on-focus',
  19.       ),
  20.     ) ;
  21.     $row[] = drupal_render($form['invite_name_'.$i]) ;
  22.     $row[] = drupal_render($form['invite_email_'.$i]) ;
  23.     $rows[] = $row ;
  24.   }
  25.   dpm($rows);
  26.   $form['invitation']['#value'] = theme('table', array(), $rows) ;
  27.   return $form ;
  28. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.