sde405 Posted January 22, 2009 Posted January 22, 2009 Hello, I have the following rule set up to format email, but I need it to do additional formatting. Rule, as it is now is below. It is designed to strip out everything after the "@" and replace it with "cliftoncpa.com". ______________________________________________________ //now we are going to prefill email //with @cliftoncpa.com //unless prefix is empty, and then it will all be blank if (Field("email")!="") { // only keep text before any @ entered, suffix is predefined var tempEmString=Field("email").split("@")[0]; // only keep text before any .com entered, suffix is predefined tempEmString=tempEmString.split(".com")[0]; return tempEmString+"@cliftoncpa.com"; } else if (Field("email") == "") { return ""; } else { return Field("email"); } If data entered is "julie.ropp@cliftoncpa.com, I would like the rule to format everything before the "@" as proper case and everything after the "@" as lower case. Like this: Julie.Ropp@cliftoncpa.comThanks in advance, Scott
Alex Marshall Posted January 22, 2009 Posted January 22, 2009 This is a rule that I came up with that will do exactly what you are looking for. The way it works is that it looks for the "@" symbol. If it finds one, then it will used the email address the user enters, if not it will append your default domain. I hope this helps, //*** rule_Email follows *** if (Field("Email") != "") { stringEmail = Field("Email"); new_stringEmail = ""; charCount = stringEmail.length; for (x=1;x<=charCount;x++) { single_char = Mid(stringEmail,x,1); ascii_code = Asc(single_char); if (ascii_code == 64) { return ToTitleCase(Field("Email")); } else { new_stringEmail = new_stringEmail + single_char; } } return ToLower(new_stringEmail) + "@example.com"; } else { return ""; }
sde405 Posted January 22, 2009 Author Posted January 22, 2009 Thanks for the quick response. Where would I place this in the existing rule?
sde405 Posted January 22, 2009 Author Posted January 22, 2009 Thanks, I tried this rule, but, it returns the following: Julie.Ropp@Cliftoncpa.Com... I need it to return: Juile.Ropp@cliftoncpa.com Any suggestions?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.