condition('v.booking_eventid', $event->eid, '=') ->fields('v') ->orderBy('v.booking_variety_start'); $result = $timeslot_query->execute(); $form['#prefix'] = '
@info', array('@name' => $fieldname, '@info' => print_r($form_state['input'], true))); unset($form_state['input']['variety-sessions'][$fieldname]); } */ //create the form element for this timeslot $form['variety-sessions'][$fieldname] = array( '#type' => 'select', '#title' => t('Variety Session: ' . $timeslot->booking_variety_time_descrip), '#required' => TRUE, '#default_value' => isset($form_state['values'][$fieldname]) ? $form_state['values'][$fieldname] : 0, '#options' => _booking_get_variety_timeslot_options($timeslot->tid), '#prefix' => '
Variety Session Options:\n@info", array('@info' => print_r( $session_options, true))); return $session_options; } /** * Callback function to rebuild the variety session fieldset */ function booking_variety_session_form_callback($form, &$form_state) { $form_state['rebuild'] = TRUE; return $form['form']['variety-sessions']; } /** * Validate the submission */ function booking_variety_regn_form_validate($form, &$form_state) { global $event; $values = $form_state['input']; //watchdog('booking_debug', 'booking_variety_regn_form_submit:
@info', array('@info' => print_r( $form_state, true))); //TODO : Check that the booking number is valid for this event //verify that user-entered data is a number if (! preg_match('/^[0-9]+$/', $values['booking_nid'])) { form_set_error('booking_nid', t('You have entered an invalid booking reference number.')); } // Perform lookup on barcode to make sure it matches someone attending the current event $db_and = db_and(); $db_and->condition('p.booking_eventid', $event->eid, '='); $db_and->condition('p.booking_status', 1, '='); $db_and->condition('p.nid', $values['booking_nid'], '='); $query = db_select('booking_person', 'p'); $query->condition($db_and) ->fields('p'); $person = $query->execute() ->fetchObject(); if (! $person) { form_set_error('booking_nid', t('You have entered an invalid booking reference number.')); } } /** * Process the submission */ function booking_variety_regn_form_submit($form, &$form_state) { global $event; $values = $form_state['input']; watchdog('booking_debug', 'booking_variety_regn_form_submit:
@info', array('@info' => print_r( $form_state, true))); }