How to validate an email address in ADF/JSF
orlandokOct 14 2009 — edited Jun 26 2012I am trying to validate and inputText component, the field is an email address so I need to validate the format is correct.
I am attempting to use the af:validateRegExp tag but i am having problems, anything use as a RegExp seems to fail.
It always reports that the email address is invalid, but I am using valid email addresses.
<af:inputText value="#{bindings.EmailAddress.inputValue}"
label="#{bindings.EmailAddress.label}"
required="true"
columns="#{bindings.EmailAddress.displayWidth}"
rows="1">
<f:validateLength minimum="6"/>
<af:validator binding="#{bindings.EmailAddress.validator}"/>
<af:validateRegExp pattern="^([a-zA-Z0-9_\-\.]+)@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$ " noMatchMessageDetail=""The value {1} is not a valid email address: ""/>
</af:inputText>
The RegExp Pattern below is not displayed correctly in the post above.
Pattern is '^[\\w\\.-]+@([\\w\\-]+\\.)+[A-Z]{2,4}$"
I am using the following website to obtain the regular expression for checking email
[http://www.tipsntracks.com/117/validate-an-email-address-using-regular-expressions.html|http://www.tipsntracks.com/117/validate-an-email-address-using-regular-expressions.html]
Is there something I am missing?
Thanks in advance
Orlando
Edited by: orlandok on Oct 14, 2009 10:38 AM