1

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

1 Answer 1

2

You don't need to code to do this. Have a look at the answers to this questions to find more information: How to modify user messages without hacking core user module?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.