Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Liferay Validating user-submitted forms

    • 0
    • 2
    • 1
    • 3
    • 0
    • 0
    • 0
    • 0
    • 544
    Comment on it

    In Liferay we can Validating the user submitted form or Validating AUI input fields. You have to add aui:validator tag and specify the appropriate attributes which we define with name property for ex: required,minLength etc . The Below Example can show how you can validate the input fields in aui forms.

    Ex:

    <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
    <%@ page import="javax.portlet.PortletPreferences" %>
    <%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
    
    <portlet:defineObjects />
    
    <portlet:actionURL name="loginCheck" var="loginURL" />
    
    <aui:form name="loginCheck" method="POST" action="<%=loginURL.toString()  %>" class="dropzone" enctype="multipart/form-data">
        <aui:fieldset>
            <aui:input name="name" >
                 <aui:validator name="required" errorMessage="Please enter your name." />
                 <aui:validator name="minLength">6</aui:validator>
            </aui:input>
    
            <aui:input name="email" >
                <aui:validator name="email" />
                 <aui:validator name="required"/>
            </aui:input>
    
            <aui:input id="message" type="textarea" name="message">
                 <aui:validator name="required" errorMessage="Please enter a message." />
            </aui:input>
        </aui:fieldset>
        <aui:input type="file" name="file" >
            <aui:validator name="acceptFiles">'jpg'</aui:validator>
        </aui:input>
    
        <aui:button type="submit" value="addDetails" />
    </aui:form>
    

 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: