Scenario:
Your customer has a business card and wants to allow people to include their telephone, extension, fax, and email. The telephone and extension are both optional. If all the information is filled out, the result would be:
Tel: 123-456-7890 x123
Fax: 123-456-0987
Email: user@yoursite.com
To set this up we would need, five fields:
1) Telephone - This would be a text field from user entry. On the data capture tab the required setting would need to be off. On the format tab, set the field usage to hide field. You can also set a text reformat.
2) Extension - This would be a text field from user entry. On the data capture tab the required setting would need to be off. On the format tab, set the field usage to hide field.
3) Fax - This would be a text field from user entry. On the data capture tab the required setting would need to be on. On the format tab, set the field usage to hide field. You can also set a text reformat.
4) Email - This would be a text field from user entry. On the data capture tab the required setting would need to be on. On the format tab, set the field usage to hide field.
5) The field script field - This field would be set as text coming from static text or field scripting. It should be placed on the master pdf in the exact location where the contact block should appear. On the format tab you would set the field usage to proof and production. On the field scripting tab, you would choose VB field scripting
You would use this script:
ifs(Telephone="" and Ext="", "", "Tel: ") & Telephone & ifs(Ext="", "", "X") & Ext & ifs(Telephone="" and Ext="", "", "<br>") & "Fax: " & Fax & "<br>" & Email
Explanation:
1) ifs(Telephone="" and Ext="", "", "Tel: ") - If Telephone and Ext fields are both blank, put nothing otherwise put Tel: followed by two spaces.
2) Telephone - We do not need an ifs statement for this portion of the script. If the Telphone field is blank, then inserting the telphone field is the same as inserting a blank.
3) ifs(Ext="", "", "X") - If the Ext field is blank, then insert nothing, otherwise insert an X.
4) Ext- We do not need an ifs statement for this portion of the script. If the Ext field is blank, then inserting the Ext field is the same as inserting a blank.
5) ifs(Telephone="" and Ext="", "", "<br>") - If the Telephone and Ext fields are both blank, then insert nothing, otherwise insert a line break.