This commit is contained in:
Nathan Coad
2018-05-02 13:30:42 +10:00
parent 3c8ed7f1e3
commit f244562358

View File

@@ -45,8 +45,8 @@ function booking_variety_regn_form($node, &$form_state)
$form['variety-sessions'] = array( $form['variety-sessions'] = array(
'#type' => 'fieldset', '#type' => 'fieldset',
'#title' => 'Select Variety Sessions', '#title' => 'Select Variety Sessions',
'#prefix' => '<div id="booking_variety_session_wrapper">', //'#prefix' => '<div id="booking_variety_session_wrapper">',
'#suffix' => '</div>', //'#suffix' => '</div>',
); );
//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
@@ -75,10 +75,13 @@ function booking_variety_regn_form($node, &$form_state)
function booking_variety_session_callback($form, &$form_state) { function booking_variety_session_callback($form, &$form_state) {
global $event; global $event;
$commands = array();
//$node = $form_state['values']['form_id']; //$node = $form_state['values']['form_id'];
$data = $form_state['input']; $data = $form_state['input'];
watchdog('booking_debug', 'booking_variety_session_callback:<br /><pre>@info</pre>', array('@info' => print_r( $data, true))); //watchdog('booking_debug', 'booking_variety_session_callback:<br /><pre>@info</pre>', array('@info' => print_r( $data, true)));
$commands = array();
// TODO : Update the wrapper for booking ID validity
// Query the variety timeslot table // Query the variety timeslot table
$timeslot_query = db_select('booking_variety_times', 'v'); $timeslot_query = db_select('booking_variety_times', 'v');
@@ -96,20 +99,14 @@ function booking_variety_session_callback($form, &$form_state) {
'#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,
//'#default_value' => '', '#options' => _booking_get_variety_timeslot_options($timeslot->tid),
//'#options' => _booking_get_variety_timeslot_options($timeslot->tid),
'#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] : '--',
'#options' => array('--'),
'#default_value' => '--',
//isset($form_state['values'][$fieldname]) ? $form_state['values'][$fieldname] : '--',
); );
// Tell drupal to update the wrapper for this field
$commands[] = ajax_command_replace('#booking_variety_session_' . $timeslot->tid . 'wrapper', drupal_render($form['variety-sessions'][$fieldname])); $commands[] = ajax_command_replace('#booking_variety_session_' . $timeslot->tid . 'wrapper', drupal_render($form['variety-sessions'][$fieldname]));
} }
$form_state['rebuild'] = TRUE; $form_state['rebuild'] = TRUE;