I want to make a confirm emailaddress like confirm password in liferay form the confirm password uses aui validator equals to, to campare both fields of password, my doubt is: Can I use this aui:validator to validate a non-password field?
Asked
Active
Viewed 959 times
2 Answers
3
we can use aui validator to validate any thing which needs to be validated. no connection with password field.
<aui:input name="lastName" value=" " showRequiredLabel="" label="Last Name"> <aui:validator name="required"/> </aui:input>
You can also include your custom validations like :
` <aui:input name="firstName" value="" showRequiredLabel="" label="First Name">
<aui:validator name="required"/>
<aui:validator name="custom" errorMessage="Enter valid First name">
function validateName(name)
{
if(name.trim() == '')
{
return true;
}
var re = /^([a-zA-Z ']{1,75})$/;
return re.test(name);
}
</aui:validator>
</aui:input>

Learner
- 976
- 14
- 29
0
Don't think this will make any difference. Compare (equalTo
) validator will only compare values of two given controls. Like:
<aui:input name="email" value='' label="Email">
<aui:validator name="email" />
</aui:input>
<aui:input name="email2" value='' label="Confirm Email">
<aui:validator name="equalTo">'#<portlet:namespace />email'</aui:validator>
</aui:input>

TheVillageIdiot
- 40,053
- 20
- 133
- 188