Thursday, October 18, 2012

Display * rather than Required label in AUI form

You need the get the label value from the " Language.properties " file rather than giving direct value in the " label " attribute in the AUI input tag.

example:-

Language.Properties : -

first-name-req = First Name <em class="star"> * <em>

email-req = Email Id <em class="star"> * <em>

phone-req = Mobile Number <em class="star"> * <em>

.jsp page :-

<aui:form name="fm" method="POST" action="<%=customerURL%>" inlineLabels="true">


<aui:input name="firstName" label="first-name-req" value='<%= %>' autocomplete="off">
<aui:validator name="required" />
<aui:validator name="minLength" errorMessage="Firs Name can not be less than 5 characters. Please try again" >5</aui:validator>
<aui:validator name="maxLength" errorMessage="First Name is too long. Please try again" >75</aui:validator>
</aui:input>

<aui:input name="emailId" label="email-req" value='<%= %>' autocomplete="off">
<aui:validator name="required" />
<aui:validator name="alphaNumeric" />
<aui:validator name="maxLength" errorMessage="First Name is too long. Please try again" >256</aui:validator>
</aui:input>

<aui:input name="phoneNo" label="phone-req" value='<%= %>' autocomplete="off">
<aui:validator name="required" />
<aui:validator name="number" />
<aui:validator name="minLength" errorMessage="First Name is too long. Please try again" >10</aui:validator>
</aui:input>

</aui:form>

css :-
.star {
   color : red ;
}

.aui-label-required {
 display : none;
}




No comments:

Liferay DXP JNDI Data Source Cofiguration

 This Blog will help us to learn about the JNDI Data Source Configuration in Liferay DXP. We have tested this with Liferay 7.3 with Tomcat. ...