How to set error message in element action?
I know this is a late reply. I hope it will help others.

You need to return false; so that the background color is red.

Example:

     if (count($criteria-&gt;ids()) &gt; 1)
     {
         $this-&gt;setMessage($this-&gt;getParams()-&gt;warningMessage);

         return false;
     }