Jump to content

formatting email rule


sde405

Recommended Posts

Posted

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

Posted

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 "";

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...