Jump to content

Adding Words after field


JCrocker

Recommended Posts

I know this is simple but I cant get it to work. Basically If field Phone1 has a # in it I need it to return the formatted phone number rule, which I have already set up, and the word "Work" if field Phone1 is empty it needs to return nothing.

 

Also Have a mobile1 field, If mobile1 field has a # I need it to return The formatted number, already setup that rule, plus the text "mobile", if its empty it need to return nothing as well.

 

Can Anyone please help me out.

 

Thanks

Jeremy

Link to comment
Share on other sites

If each number is on its own line, you don't need another rule. You can simply type "Work" and insert the variable for the phone formatting rule in the Text Editor, then click the Paragraph button, and select "Suppress if Containing Empty Variables." Do the same on another line for the mobile number.

 

EDIT: Just like in Dan Leahy's screenshot above. Thanks, Dan! :)

Link to comment
Share on other sites

Easiest way to do it in JavaScript is set them up as variables then prepend the prefix to the number if there is something there. Otherwise it equals and empty string.

 

var ph1 = "";
if (Field("Phone1").length > 0)
ph1 = "Work: " + Field("Phone1");

 

Or easier yet, use the built in suppress (see attached).

suppressline.jpg.df6359b77cc1a024aba3c42b92b22ef9.jpg

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...