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(
'#type' => 'fieldset',
'#title' => 'Select Variety Sessions',
'#prefix' => '<div id="booking_variety_session_wrapper">',
'#suffix' => '</div>',
//'#prefix' => '<div id="booking_variety_session_wrapper">',
//'#suffix' => '</div>',
);
//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) {
global $event;
$commands = array();
//$node = $form_state['values']['form_id'];
$data = $form_state['input'];
watchdog('booking_debug', 'booking_variety_session_callback:<br /><pre>@info</pre>', array('@info' => print_r( $data, true)));
$commands = array();
//watchdog('booking_debug', 'booking_variety_session_callback:<br /><pre>@info</pre>', array('@info' => print_r( $data, true)));
// TODO : Update the wrapper for booking ID validity
// Query the variety timeslot table
$timeslot_query = db_select('booking_variety_times', 'v');
@@ -96,20 +99,14 @@ function booking_variety_session_callback($form, &$form_state) {
'#type' => 'select',
'#title' => t('Variety Session: ' . $timeslot->booking_variety_time_descrip),
'#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">',
'#suffix' => '</div>',
'#options' => array('--'),
'#default_value' => '--',
//isset($form_state['values'][$fieldname]) ? $form_state['values'][$fieldname] : '--',
'#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]));
}
$form_state['rebuild'] = TRUE;