By divyeshvk on
I am created webform for user to enter their Email address for new update.
For this I want validation of field as follows:
If email is already presented into Database he shows error:
Following code I am added into webform Advanced Setting :
Advanced validation code:
foreach ($form_values['submitted'] as $field_id => $value) {
$component = $node->webformcomponents[$field_id];
if (strpos($component['name'],"email") !== FALSE && valid_email_address($value)) {
if ($validUser = user_load(array('mail'=>$value))) {
form_set_error('',t('The email is already present!'));
}
}
}
Advanced Processing code:
$Emails = array();
foreach ($form_values['submitted'] as $field_id => $value) {
$component = $node->webformcomponents[$field_id];
if (strpos($component['name'],"email") !== FALSE && valid_email_address($value)) {
$Emails[] = $value;
}
}
$message = "Your message here.";
but after submitting form there is no output.
no error.
Please suggest any changes into code. Or How I can do this?
Thank you in advanced for your help.