This commit is contained in:
Nathan Coad
2018-05-02 13:51:59 +10:00
parent 5beb81a47f
commit 22d6e0a03d

View File

@@ -128,18 +128,20 @@ function booking_variety_session_callback($form, &$form_state) {
//for each entry in the variety timeslot table, create a new form select item //for each entry in the variety timeslot table, create a new form select item
foreach($result as $timeslot) { foreach($result as $timeslot) {
$fieldname = 'select-variety-' . $timeslot->tid; $fieldname = 'select-variety-' . $timeslot->tid;
$options = _booking_get_variety_timeslot_options($timeslot->tid);
watchdog('booking_debug', 'Timeslot @tid form state value: <pre>@info</pre>', watchdog('booking_debug', 'Timeslot @tid form state value: <pre>@info</pre>',
array('@tid' => $timeslot->tid, '@info' => print_r($form_state['values'], true))); array('@tid' => $timeslot->tid, '@info' => print_r($form_state['values'], true)));
watchdog('booking_debug', $options[$form_state['values'][$fieldname]]);
//re-create the form element for this timeslot //re-create the form element for this timeslot
$form['variety-sessions'][$fieldname] = array( $form['variety-sessions'][$fieldname] = array(
'#type' => 'select', '#type' => 'select',
'#title' => t('Variety Session: ' . $timeslot->booking_variety_time_descrip), '#title' => t('Variety Session: ' . $timeslot->booking_variety_time_descrip),
'#required' => TRUE, '#required' => TRUE,
'#options' => _booking_get_variety_timeslot_options($timeslot->tid), '#options' => $options,
'#prefix' => '<div id="booking_variety_session_' . $timeslot->tid . 'wrapper">', '#prefix' => '<div id="booking_variety_session_' . $timeslot->tid . 'wrapper">',
'#suffix' => '</div>', '#suffix' => '</div>',
'#default_value' => isset($form_state['values'][$fieldname]) ? $form_state['values'][$fieldname] : '', '#default_value' => isset($form_state['values'][$fieldname]) ? $options[$form_state['values'][$fieldname]] : 0,
); );
// Tell drupal to update the wrapper for this field // Tell drupal to update the wrapper for this field