diff --git a/booking.regn_form.inc b/booking.regn_form.inc index e3dc3c4..666f566 100644 --- a/booking.regn_form.inc +++ b/booking.regn_form.inc @@ -951,7 +951,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) $freestyle_required_check = (variable_get('booking_require_freestyle', 1) == 1) && $inserting; $form['misc-areas']['booking_freestyle_text'] = array( '#type' => 'textfield', - '#title' => t("Freestyle (optional)"), + '#title' => t("Freestyle text (anything you'd like to share)"), '#maxlength' => 500, '#required' => $freestyle_required_check, '#default_value' => !empty($data->booking_freestyle_text) ? $data->booking_freestyle_text : '' @@ -1227,13 +1227,19 @@ function booking_form_validate($form, &$form_state) { } //verify alternate guardian phone number - if (($data['booking_guardian_phone_alt'] != '') && (!_valid_phone_number($data['booking_guardian_phone_alt']))) + if (($data['booking_guardian_phone_alt'] != '') && (!_valid_phone_number($data['booking_guardian_phone_alt']))) { form_set_error('booking_guardian_phone_alt', t('You have entered an invalid alternate contact phone number for your emergency contact.')); - + } + //check the terms and conditions have been agreed to. Do this one last so it stands out more - if ($data['booking_agreement'] == 0) + if ($data['booking_agreement'] == 0) { form_set_error('booking_agreement', t('You must read and agree with the aims and expectations prior to submitting this form.')); - + } + + if (variable_get('booking_enable_previous_studyweeks', 0) == 1 && $data['booking_prev_sw_count'] == '') { + form_set_error('booking_prev_sw_count', t('You must select the number of study weeks that you\'ve previously attended.')); + } + //if there are any errors then log the data the user entered so we can check it later if (form_get_errors()) { watchdog('booking', "
Detected validation error(s):\n@errors\n\n User data:\n@info
", array( @@ -1371,6 +1377,7 @@ function booking_form_submit($form, &$form_state) $node->booking_earlyaccess_code_id = empty($values['booking_earlyaccess_code']) ? 0 : $earlyaccess_query->cid; $node->booking_song_choice = empty($values['booking_song_choice']) ? '' : $values['booking_song_choice']; $node->booking_freestyle_text = empty($values['booking_freestyle_text']) ? '' : $values['booking_freestyle_text']; + $node->booking_prev_sw_count = empty($values['booking_prev_sw_count']) ? '0' : $values['booking_prev_sw_count']; //remove newlines from these fields so the CSV output doesn't get messed up $medical = empty($values['booking_medical_conditions']) ? 'N/A' : $values['booking_medical_conditions'];