function webform_validate in Webform 6.2
Same name and namespace in other branches
- 5.2 webform.module \webform_validate()
- 5 webform.module \webform_validate()
Implementation of hook_validate().
File
- ./
webform.module, line 973
Code
function webform_validate(&$node) {
// Ensure the entered e-mail addresses are valid.
if (!empty($node->webform['email'])) {
$emails = explode(',', $node->webform['email']);
foreach ($emails as $email) {
if (!valid_email_address(trim($email))) {
form_set_error('webform][email', t('The entered email address %address is not a valid address.', array(
'%address' => $email,
)));
break;
}
}
}
if ($node->webform['email_from_address_option'] == 'custom') {
if (!valid_email_address($node->webform['email_from_address_custom'])) {
form_set_error('webform][email_from_address_custom', t('The entered email address %address is not a valid address.', array(
'%address' => $node->webform['email_from_address_custom'],
)));
}
}
}