I wanted the error messages from the webform to be customised. So I wrote following piece of code in template.php of my theme.
function sandesh_preprocess_node_webform(&$vars, $hook) {
if ($vars['node']->nid == "41" && is_array($_SESSION['messages']['error'])) {
$errors = &$_SESSION['messages']['error'];
$find = 'email';
for($idx = 0; $idx < count($errors); $idx++) {
if (substr($errors[$idx], 0, strlen($find)) == $find) {
$errors[$idx] = 'Please enter the email field';
break;
}
}
}
}
But this is not working. Is there something wrong in the code? Or is there any other method to get customized error message in the webforms ? Thank you