liferayliferay-6liferay-aui

Liferay <aui:validator> for dates?


I'm trying to make a simple custom aui:validator for the birthday field on the registration form but it is simply not working. Any ideas?

<aui:input name="birthday" value="<%=birthday%>">
    <aui:validator name="custom" errorMessage="some-error">
        function (val, fieldNode, ruleValue) {
            return false;
        }
    </aui:validator>
</aui:input>

What I'd like to achieve is to check if the user is 18 years old at the registration.

Any hints would be greatly appreciated!


Solution

  • Unfortunately I wasn't able to use Lucky Boy's solution either. For some mysterious reason it didn't work at the create_account.jsp file.

    As a workaround I create a new exception in the header of the file:

    <liferay-ui:error exception="<%=NotOldEnoughException.class%>"
        message="Not old enough" />
    

    And made the checking in a hooked version of the EditUserAction file.