Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Creating a new type of aui validator in liferay

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 617
    Comment on it

    Liferay use aui validator to validate input field of the form. Alloy script provide default validator but many times we need to create new type validator.

    See below default liferay aui validator :

    <aui:input name="firstName" type="text" maxlength="40">
        <aui:validator name="required" />
        <aui:validator name="alpha" />
    </aui:input>
    

    Now, You can create your own type aui validator as below :

    <aui:input name="firstName" type="text">
        <aui:validator name="myValidator" errorMessage="numbers-not-allowed">
            function(val, fieldNode, ruleValue){ 
                var matches = val.match(/\d+/g);
                if(matches != null)
                    return false;
                else
                    return true;
           }
        </aui:validator>
    </aui:input>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: