· Chris Hammond
Last Updated
Dnn Module Validate International Phone Numbers
Learn how to validate international phone numbers in DotNetNuke's registration pages using a simple regular expression with no code changes required.
Working on a customized version of the registration pages for dotnetnuke I needed a good regular expression to validate international phone numbers.
I ended up adding this line to my “register.aspx” page.
<asp:regularexpressionvalidator id="valTelephone2" runat="server" cssclass="NormalRed" display="Dynamic" errormessage="<br>Office Phone Must be Valid."
controltovalidate="txtTelephone" resourcekey="valTelephone2" validationexpression="^(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]*$"></asp:regularexpressionvalidator>
This requires no actual code behind changes, though I would recommend adding the proper information to your local resource file for language handling.