process names fields to always be Title Case

This commit is contained in:
2017-09-12 08:44:21 +10:00
parent 9910b523c6
commit 557b99966d
4 changed files with 52 additions and 30 deletions

View File

@@ -917,7 +917,7 @@ function booking_form($node, &$form_state, $inserting = FALSE, $early_access_all
if (variable_get('booking_enable_roommate', 0) == 1) {
$form['misc-areas']['booking_room_mate1'] = array(
'#type' => 'textfield',
'#title' => t('List up to two people you would like to share a room with (subject to availability).'),
'#title' => t('List up to two people you would like to share a room with (subject to availability)'),
'#maxlength' => 200,
'#required' => FALSE,
'#default_value' => !empty($data->booking_room_mate1) ? $data->booking_room_mate1 : ''
@@ -935,7 +935,7 @@ function booking_form($node, &$form_state, $inserting = FALSE, $early_access_all
if (variable_get('booking_enable_songchoice', 0) == 1) {
$form['misc-areas']['booking_song_choice'] = array(
'#type' => 'textfield',
'#title' => t("Let us know if there's a song you'd love to sing during the week."),
'#title' => t("Let us know if there's a song you'd love to sing during the week"),
'#maxlength' => 200,
'#required' => TRUE,
'#default_value' => !empty($data->booking_song_choice) ? $data->booking_song_choice : ''
@@ -1216,6 +1216,11 @@ function booking_form_submit($form, &$form_state)
$values = $form_state['input'];
//do some preprocessing on input
//convert names from whatever case they're in to Title Case
$values['booking_firstname'] = _booking_ucname($values['booking_firstname']);
$values['booking_lastname'] = _booking_ucname($values['booking_lastname']);
//strip any emojis from user input
if (variable_get('booking_enable_emoji_removal', 1) == 1) {
foreach ($values as $key => $value) {