---
title: "Conditional fields (legacy templates)"
slug: "conditional-fields-pre-2022-legacy"
description: "Wrap a field in legacy if tags, like {if_phone}, so it appears only when the user has a value, and use nif tags to show fallback text when it is empty."
updated: 2024-01-14T02:23:51.000Z
canonical: "https://help.opensense.com/docs/conditional-fields-pre-2022-legacy"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://help.opensense.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Conditional fields (legacy templates)

## Overview

This article is for pre-2022 templates, built with our legacy HTML syntax: **use it if your tags are in `$tag;` format.** If you use Liquid templates, see [Conditional fields (Liquid templates)](https://help.opensense.com/docs/conditional-fields-new-liquid-templates).

- You can make a field optional if some users use it and others don't. Optional fields are removed automatically from email signatures that don't use the field.
- You can wrap IF statements around any signature element, to make it appear only if that field is used.


## Conditional fields that share a line

**HTML code.** Each field has its own `{if_field}` block, and a nested condition shows the separator only when both fields have values:

<img src="https://help.opensense.com/media/oldconditionalfields1-4e7021b8da61.png" alt="Legacy HTML with {if_phone} and {if_mobile} blocks around the phone and mobile, and a nested if_phone and if_mobile block around the separator" width="1229" height="802" loading="lazy" decoding="async">

**Signature preview with logic:**

<img src="https://help.opensense.com/media/oldconditionalfields2-dfc7dcbee92c.png" alt="The signature preview showing the phone, separator, and mobile, each wrapped in its legacy if tags" width="590" height="105" loading="lazy" decoding="async">

**Recipient's email rendering.** If either field is removed, the separator line is removed too.

<img src="https://help.opensense.com/media/oldconditionalfields3-3a3959bc82b9.png" alt="A rendered line with a phone number and a mobile number separated by a vertical bar" width="427" height="43" loading="lazy" decoding="async">


## A conditional field on its own line

**HTML code.** The whole table row is wrapped in the field's if tags:

<img src="https://help.opensense.com/media/oldconditionalfields4-c2787e05911e.png" alt="Legacy HTML with a table row for a scheduling link wrapped in {if_calendar_link} and {/if_calendar_link}" width="1655" height="268" loading="lazy" decoding="async">

**Signature preview with logic:**

<img src="https://help.opensense.com/media/oldconditionalfields5-986310c71748.png" alt="A signature preview with the calendar link, mobile, and email lines wrapped in their legacy if tags" width="1117" height="270" loading="lazy" decoding="async">

## "Not if" logic

Need "not if" logic? Opensense can do this too. Wrap your HTML code with `{nif_field}Alternative Text{/nif_field}` instead.

For example: `{nif_phone}1-800-MAINLINE{/nif_phone}`

## What's next

- [Hidden fields (legacy templates)](https://help.opensense.com/docs/hidden-fields-pre-2022-legacy)
- [HTML and field types (legacy templates)](https://help.opensense.com/docs/html-field-types-1)

For further help, contact Opensense Support at [help@opensense.com](mailto:help@opensense.com).
