Email confirmation field added
This commit is contained in:
@@ -426,6 +426,17 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
|
||||
'#required' => TRUE,
|
||||
'#default_value' => !empty($data->booking_email) ? $data->booking_email : ''
|
||||
);
|
||||
|
||||
// Only confirm email address if the user is typing in their details
|
||||
if ($inserting == TRUE) {
|
||||
$form['contact-details']['booking_email_confirm'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Confirm e-mail address'),
|
||||
'#maxlength' => 100,
|
||||
'#required' => TRUE,
|
||||
'#default_value' => !empty($data->booking_email_confirm) ? $data->booking_email_confirm : ''
|
||||
);
|
||||
}
|
||||
|
||||
$form['contact-details']['booking_phone'] = array(
|
||||
'#type' => 'textfield',
|
||||
@@ -1119,6 +1130,15 @@ function _booking_validate($node, &$form_state) {
|
||||
$email = (isset($form_state['booking_email']) ? $form_state['booking_email'] : $node->booking_email);
|
||||
if (strlen(trim($email)) > 0 && !_valid_email_address($email))
|
||||
form_set_error('booking_email', t('You must enter a valid e-mail address. Please ensure you typed your email address correctly.'));
|
||||
|
||||
//make sure that the email confirmation field matches the first email address entry
|
||||
$email_confirm = (isset($form_state['booking_email_confirm']) ? $form_state['booking_email_confirm'] : $node->booking_email);
|
||||
$email = preg_replace( '/\s+/', '', $email );
|
||||
$email_confirm = preg_replace( '/\s+/', '', $email_confirm );
|
||||
if (strcasecmp($email, $email_confirm) !== 0)
|
||||
{
|
||||
form_set_error('booking_email', t('Your email address does not match. Please ensure you typed your email address correctly.'));
|
||||
}
|
||||
|
||||
//if DOB on form is more recent than DOB limit, display validation error
|
||||
if ($dob_check > _booking_max_dob_ts())
|
||||
@@ -1274,7 +1294,7 @@ function booking_form_submit($form, &$form_state) {
|
||||
$node->booking_country = $values['booking_country'];
|
||||
$node->booking_phone = $values['booking_phone'];
|
||||
$node->booking_mobile = $values['booking_mobile'];
|
||||
$node->booking_email = strtolower($values['booking_email']);
|
||||
$node->booking_email = strtolower(trim($values['booking_email']));
|
||||
$node->booking_ecclesia = ucwords($values['booking_ecclesia']);
|
||||
$node->booking_baptised = ($values['booking_baptised'] == 1 ? 'Y' : 'N');
|
||||
$node->booking_married = empty($values['booking_married']) ? 'N' : ($values['booking_married'] == 1 ? 'Y' : 'N');
|
||||
|
Reference in New Issue
Block a user