try removing old tableselect first

This commit is contained in:
2016-05-26 10:57:33 +10:00
parent dd780489ec
commit c03203bec6

View File

@@ -168,22 +168,24 @@ function _booking_manual_email_selecttype_dropdown_callback($form, &$form_state)
$cached_form = form_get_cache($form['#build_id'], $form_state); $cached_form = form_get_cache($form['#build_id'], $form_state);
watchdog('booking_debug', "<pre>Manual email cached form\n@info</pre>", array('@info' => print_r( $cached_form, true))); watchdog('booking_debug', "<pre>Manual email cached form\n@info</pre>", array('@info' => print_r( $cached_form, true)));
//unset old tableselect
unsset($form['table']);
// configure new tableselect based on old table select // configure new tableselect based on old table select
$form['new']['table'] = $cached_form['form']['table']; $form['table'] = $cached_form['form']['table'];
//set new default values //set new default values
//$form['new']['table']['#default_value'] = $new_default_values; //$form['new']['table']['#default_value'] = $new_default_values;
watchdog('booking_debug', "<pre>Manual email new form table\n@info</pre>", array('@info' => print_r( $form['new']['table'], true))); watchdog('booking_debug', "<pre>Manual email new form table\n@info</pre>", array('@info' => print_r( $form['table'], true)));
watchdog('booking_debug', "<pre>Manual email new default values\n@info</pre>", array('@info' => print_r( $form['new']['table']['#default_value'], true))); watchdog('booking_debug', "<pre>Manual email new default values\n@info</pre>", array('@info' => print_r( $form['table']['#default_value'], true)));
watchdog('booking_debug', "<pre>Manual email new form array\n@info</pre>", array('@info' => print_r( $form['new'], true))); watchdog('booking_debug', "<pre>Manual email new form array\n@info</pre>", array('@info' => print_r( $form, true)));
//$new_html = drupal_render($form['new']['table']); //$new_html = drupal_render($form['new']['table']);
//watchdog('booking_debug', "<pre>Manual email rendered table\n@info</pre>", array('@info' => print_r( $new_html), true)); //watchdog('booking_debug', "<pre>Manual email rendered table\n@info</pre>", array('@info' => print_r( $new_html), true));
// update the tableselect // update the tableselect
$commands = array(); $commands = array();
$commands[] = ajax_command_replace('#manual-email-attendees-items', drupal_render($form['new']['table'])); $commands[] = ajax_command_replace('#manual-email-attendees-items', drupal_render($form['table']));
return array('#type' => 'ajax', '#commands' => $commands); return array('#type' => 'ajax', '#commands' => $commands);
} }