How i can change css styles of input fields and labels when alloy ui form validator detect a empty field?
This is one of the fields
<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' />
And this is Alloy Ui script
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"/>'
}
}
});
});
You can change the CSS that AlloyUI FormValidator
applies with the errorClass
and validClass
attributes:
new Y.FormValidator({
/* your code here... */
errorClass: 'your-new-error-class',
validClass: 'your-new-valid-class'
});
You may also want to check out containerErrorClass
and containerValidClass
.