Thank you! I'm tired of having invalid email addresses entered in the email address fields. I was thinking about using the keyup and replace method to eliminate unacceptable characters, but then I'd still need a formula field to check if the character string created something similar to an email address.
I'm attempting to create a pattern to cover both problems at once. Here's where I am now, which seems to catch it as a valid email address, but won't release after a fix when it was invalid first:
(function(){
var dbid = "mydbid";
var dbidTable1 = "mytbid";
var apptoken = "myapptoken";
$.ajaxSetup({data: {apptoken: apptoken}});
var querystring=document.location.search;
if(/a=er/i.test(querystring) || /a=nwr/i.test(querystring)) {
$("#_fid_6").attr({
pattern: "^((([!#$%&'*+\-/=?^_'{|}~\w])|([!#$%&'*+\-/=?^_'{|}~\w][!#$%&'*+\-/=?^_'{|}~\.\w]{0,}[!#$%&'*+\-/=?^_'{|}~\w]))[@]\w+([-.]\w+)*\.\w+([-.]\w+)*)$",
required: "required",
oninvalid: "setCustomValidity('Please use the format:
xxxx@yyy.zzz')"
});
})
}
})();
My other thought was to use the keyup and replace with a target field that set as true or false whether the pattern matched.