How can I use field scripting to make "Tel:" disappear if both the phone and extension fields are left blank?

EDOCBUILDER > eDocBuilder FAQs
Scenario: Your customer has a business card and wants to allow people to include their telephone, extension, fax, and email. If all the information is filled out, the result would be:

Tel: 123-456-7890, x123
Fax: 123-456-0987
Email: user@yoursite.com

However, you want them to be able to leave the extension field blank but keep the phone number OR omit the telephone line completely by leaving both the telephone and extension fields blank. If they leave both the telephone field and extension field blank, then you also need the "Tel: " text to disappear so the other lines can slide up.

This is possible only through VB scripting, not through HTML field scripting. The VB script you would use is:

ifs(Telephone="" and Ext="","","Tel: ") & ifs(Telephone="","",Telephone) & ifs(Ext="","",", " & Ext) & ifs(Telephone="" and Ext="","","<br>") & "Fax: " & Fax & "<br>" & Email

Notes: 
1) Before pasting this script from this knowledge base article into your field's Field Scripting tab, please paste it into Notepad or another plain text editor. Then re-copy it and paste it into your template so that no formatting is carried over from the web version.
2) This script assumes that your fields are named Telephone, Ext, Fax, and Email. You will need to adjust your script to match the field names of your own template.
3) Field names do not have quotation marks around them in VB script, but text that you want to appear, as well as the <br> line break tags, do have quote marks. (Any HTML tags that you include in a VB script need to have quotation marks around them.)
4) Looking at the very first part of the script, you can see the basic setup of an expression in VB script:
ifs(Telephone="" and Ext="","","Tel: ")
This basically says: If the Telephone field is blank and the Ext field is blank, then enter nothing, otherwise output the text "Tel: ".

Color is added for emphasis only.