如何在 alloy-ui 表单验证器上更改 css 样式?

How to change css styles on alloy-ui form validator?

当 alloy ui 表单验证器检测到空字段时,我如何更改 css 输入字段和标签的样式?

这是字段之一

<label for='<portlet:namespace  />formnumdoc'>
    <liferay-ui:message key="formulario.DOCUMENT"/><span class="red_mini">*</span>
</label>
<input type='text' id='<portlet:namespace  />formnumdoc' name='formnumdoc' />

这是 Alloy Ui 脚本

YUI().use('aui-form-validator', function(Y) {
    new Y.FormValidator({
        boundingBox : '#frmEntity',
        rules : {
            formnumdoc : {
                required : true
            }
        },
        fieldStrings: {
            formnumdoc: {
                required: '<liferay-ui:message key="formulario.REQUIRED_FIELD_ALERT"/>'
              }
            }
    });
});

您可以更改 AlloyUI FormValidator applies with the errorClass and validClass 属性的 CSS:

new Y.FormValidator({
    /* your code here... */
    errorClass: 'your-new-error-class',
    validClass: 'your-new-valid-class'
});

您可能还想查看 containerErrorClass and containerValidClass