We all run into errors using Drupal– most of which are easy to fix. Some, however, are not so easy to fix and require many hours of digging even though the website works fine with the error.
My question: To work around this digging, is it possible to have Drupal assign a specific CSS class to each error so you can easily make it display:none?
If there isn’t a way to do this, is it possible to assign a display:none; to the parent element (the error “div” in this case below) if – for example – the error string = "Warning: Invalid argument supplied for foreach() in element_children() (line 6282 of /var/www/html/includes/common.inc)." using jQuery / Javascript?
<div class="messages error">
<h2 class="element-invisible">Error message</h2>
<em class="placeholder">Warning</em>
: Invalid argument supplied for foreach() in
<em class="placeholder">element_children()</em>
(line
<em class="placeholder">6282</em>
of
<em class="placeholder">/var/www/html/includes/common.inc</em>
).
</div>
Thanks for the help
Hiding error messages using CSS is a very very very bad idea. Instead, you should turn off error reporting to screen by going to Administration » Configuration » Development » Logging and errors and turning Error messages to display to none.
With that switched off, no one will see those errors but, as the admin, you can view them yourself by going to Administration » Reports » Recent log messages.