如何在Joomla 2.5中添加“无效”类来形成元素

I have added "invalid" class using mootools http://docs.joomla.org/Client-side_form_validation

Now I want to add this class from Server side. Need help on this.

There is second option for you. You can try with checking which error message.

try this:

CSS Code:

.invalid {
    border: 2px solid #FF0000;
    border-radius: 7px 7px 7px 7px;
}

jQuery Code:

jQuery.noConflict();
    jQuery(document).ready(function(){
        jQuery(function(){
            if(jQuery( "#system-message li:contains('Please enter your email address.')").length >0){
                jQuery('.left_reset_bar #jform_email').addClass('invalid');
            }
        });
    });

Note: Replace this "Please enter your email address." with your message.

I hope this will solve your problem.