email address validation rule?

W

Wayne

I am just getting my feet wet with infopath so I am a little green. However,
the form I have created is a simple SQL database that contains email
addresses for a newsletter. I just want to have the users add their email
address from the form which works, but I am unable to get any sort of
validation to work. Is there a common pattern I should be using in the data
enty custom pattern choice?
Pointers would be appreciated.
 
A

Adam Harding

Wayne

How about chekcing the email address contains '@domainname.com'

or just containing @?

Something like that anyway.

Cheers Adam
 
S

S.Y.M. Wong-A-Ton

Try adding Data Validation with a "does not match pattern" condition and a
"Custom Pattern" such as

([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)
 
W

Wayne

That worked...I was playing with RegEx phrases but I was not successful.
Thanks for the tip.

S.Y.M. Wong-A-Ton said:
Try adding Data Validation with a "does not match pattern" condition and a
"Custom Pattern" such as

([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)

---
S.Y.M. Wong-A-Ton


Wayne said:
I am just getting my feet wet with infopath so I am a little green.
However,
the form I have created is a simple SQL database that contains email
addresses for a newsletter. I just want to have the users add their email
address from the form which works, but I am unable to get any sort of
validation to work. Is there a common pattern I should be using in the
data
enty custom pattern choice?
Pointers would be appreciated.
 
R

Rajani

To assign a data entry pattern to the E-mail Address text box
With the form still open, double-click the E-mail Address text box.
In the Text Box Properties dialog box, on the Data tab, click Data
Validation.
In the Data Validation dialog box, click Add.
Make sure that the first box under If this condition is true contains the
control's field ("email"), and then in the second box, click does not match
pattern.
In the third box, click Select a pattern.
In the Data Entry Pattern dialog box, in the Standard patterns list, select
Custom pattern to clear the existing text in the Custom pattern box. Patterns
use the syntax defined by the W3C XML Schema pattern restrictions.
In the Insert special character list, select Any Letter.
In the Insert special character list, select One or more.
In the Custom pattern box, type @contoso after the existing characters.
In the Insert special character list, select Period.
In the Custom pattern box, type com after the existing characters. The
custom data entry pattern should look like this: .+@contoso\.com
Click OK to exit the Data Entry Pattern dialog box.
In the ScreenTip box in the Data Validation dialog box, type Please use your
Contoso e-mail address. This text appears when a user points to or
right-clicks the control.
Close all open dialog boxes.
To test your changes, click Preview Form on the Standard toolbar. Type
(e-mail address removed) in the E-mail Address text box. A dashed red line appears
around the text box, which indicates that there's a problem with the data you
entered. When you move your mouse pointer over the text box, the ScreenTip
that you specified in step 13 appears.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top