简体   繁体   English

如何在Joomla 2.5中向表单元素添加“无效”类

[英]How to add “invalid” class to form element in Joomla 2.5

I have added "invalid" class using mootools http://docs.joomla.org/Client-side_form_validation 我使用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: CSS代码:

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

jQuery Code: jQuery代码:

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. 我希望这能解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM