This is a sample.
Insert in you portlet JSP the alloyui taglib with the right use attribute to have within the context the A.FormValidator
object:
<aui:script use="aui-form-validator">
var validator = new A.FormValidator({
boundingBox: form,
rules: {
'<portlet:namespace />emailAddress': {
email: true
},
'<portlet:namespace />countryId': {
required: true
}
},
strings: {
required: '<liferay-ui:message key="this-field-is-required" />'
}
});
</aui:script>