improve validate

This commit is contained in:
Nathan Coad
2018-05-03 08:29:58 +10:00
parent cd1493ef4a
commit 3cfca677ea

View File

@@ -167,6 +167,13 @@ function booking_variety_regn_form_validate($form, &$form_state) {
//check there is still room
foreach ($variety_timeslot_ids as $id) {
$selected_session_id = $values['select-variety-' . $id];
// Don't try and check availablity for a select element that is still on the default value
if ($selected_session_id == 0) {
form_set_error('select-variety-' . $id, t('You have not selected a variety session.'));
continue;
}
$session = $sessions[$selected_session_id];
if ($session->booking_variety_regncount < $session->booking_variety_maxsize) {
watchdog('booking_debug', 'Still room in session @id : @count is less than @size', array(