0

How to remove webform error message? I need to be able to remove the error message form.

For instance, if I have an email field and for some reason did not pass the validation is not to show a message saying.

The entered e-mail address "djhshsj" does not appear valid.

So my question is how I can remove that Drupal message?

Update 1: I had to render the error message below the button (I could not just move with CSS ). So I ended up doing my custom validation + error message. And even though I have my custom validation, webform still validate if that field is correct or not. However, all I want to do is to remove the message NOT the validation.

  • "djhshsj" is indeed not valid, why would you want to remove this? You want to save invalid/useless e-mail addresses on your DB? – No Sssweat Jan 13 '16 at 12:00
  • Why would someone put an invalid input there? perhaps they find giving an e-mail annoying or time consuming? Then you would be better off making the e-mail optional if that's what you want. – No Sssweat Jan 13 '16 at 12:05
  • @NoSssweat, I have update my question with more content of the situation. So you can have an understanding, of what is going on. – itsdarrylnorris Jan 13 '16 at 16:13
0

drupal_get_messages() returns all the messages set using drupal_set_message, which also includes error messages set during form validation. This also clears the messages.

You can then add a custom validate handler to the webform by altering it by implementing hook_form_alter or hook_form_FORM_ID_alter.

In your custom validate handler, call drupal_get_messages() to clear any error messages.

  • I try it on, hook_form_alter and I did not remove the webform error. However, all Krumos (dpm) errors was remove :s. – itsdarrylnorris Jan 15 '16 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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