Created
March 18, 2014 18:56
-
-
Save joachim-n/9626938 to your computer and use it in GitHub Desktop.
validation handler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$selected_sessions = array(); | |
foreach (array_keys($form_state['values']['timeslots']) as $timeslot_id) { | |
foreach (array_keys($form_state['values']['timeslots'][$timeslot_id]['rooms']) as $room_id) { | |
$cell_form_state_value = $form_state['values']['timeslots'][$timeslot_id]['rooms'][$room_id]['session']; | |
if (!empty($cell_form_state_value)) { | |
$selected_sessions[$cell_form_state_value][] = array($timeslot_id, $room_id); | |
} | |
} | |
} | |
foreach ($selected_sessions as $cell_form_state_value => $timeslot_room_pairs) { | |
if (count($timeslot_room_pairs) > 1) { | |
foreach ($timeslot_room_pairs as $timeslot_room_pair) { | |
list($timeslot_id, $room_id) = $timeslot_room_pair; | |
form_error($form['timeslots'][$timeslot_id]['rooms'][$room_id]['session'], t('Repeated session!')); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment