---
title: "Hiding Address Fields"
slug: "hiding-address-fields"
updated: 2025-07-17T22:16:58Z
published: 2025-07-17T22:16:58Z
stale: true
---

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

# Hiding Address Fields

When creating a form you may want to collect only **City** and **Postcode**, which are mandatory, but don't want to collect **Address 1 to 4** details. To achieve this proceed as follows:

#### 1. While editing your form, select the Person or Organisation Address field

1) On the form builder use the **Show/Hide Design Options** to show the CSS for each Field.

2) Set the **Mandatory** option to **Yes**

3) In the field next to **CSS Class For Label and Field**, enter **addshowhide**

![image.png](https://cdn.document360.io/d198920d-a212-4177-85f9-e1abc92e7ab3/Images/Documentation/image-HCTQJ2T3.png)

#### 2. Add Custom CSS via Form Settings​

On the **Form Settings** page, use the Additional CSS Code to enter any relevant CSS code, from the Code I have provided Below. I've given an explanation of the CSS function, in case you want to use this for other configurations. The Actual code needed is at the bottom of the email.

![image.png](https://cdn.document360.io/d198920d-a212-4177-85f9-e1abc92e7ab3/Images/Documentation/image-IY15L140.png)

#### 3. Remove Line spacing and Address lines

Use the code below to hide the relevant lines from the from.

For completeness, the code includes the details for Address lines 1 through 4, as well as Area/State, City and Postcode.

To leave just Area/State and Postcode on the form, **do not include** the lines that include **.aare** (Area/State) or **.azip** (Postcode):

```
/* remove spaces between lines */
.addshowhide br {display:none}
/* add the lines you want hidden on the form */
.addshowhide .addresslabela1, .a1input { display:none }
.addshowhide .addresslabela2, .a2input { display:none }
.addshowhide .addresslabela3, .a3input { display:none }
.addshowhide .addresslabela4, .a4input { display:none }
.addshowhide .aare {display:none}
.addshowhide .acty {display:none}
.addshowhide .azip {display:none}
```

#### 4. Set Visible fields as Mandatory​

Use the code below to remove the mandatory setting from all address lines (so the hidden fields do not flag as mandatory) and then set the Mandatory Flag just for those needed.

The code shown below will set the Area/State and Postcode as mandatory. But you can replace the area code fields below (**.addresslabelaare** or **.aareinput**) with whichever field is needed.

```
</style>
<script type="text/javascript">
//if you want fields to be mandatory other than the addressline1
function userPageLoaded() {
//address - remove mandatory setting
$(".addresslabela1").closest(".entryAddress").addClass('notmandatory');
//city - make mandatory
$(".addresslabelaare").closest(".entryAddress").removeClass("notmandatory");
$(".aareinput").removeClass('skipmandatory');
}
</script>
<style>
```

So, the full code needed for CSS and Javascript to show only State and Post Code, and setting both as mandatory, is:

```
/* remove spaces between lines */
.addshowhide br {display:none}
/* add the lines you want hidden on the form */
.addshowhide .addresslabela1, .a1input { display:none }
.addshowhide .addresslabela2, .a2input { display:none }
.addshowhide .addresslabela3, .a3input { display:none }
.addshowhide .addresslabela4, .a4input { display:none }
.addshowhide .acty {display:none}
</style>
<script type="text/javascript">
//if you want fields to be mandatory other than the addressline1
function userPageLoaded() {
//address - remove mandatory setting
$(".addresslabela1").closest(".entryAddress").addClass('notmandatory');
//city - make mandatory
$(".addresslabelaare").closest(".entryAddress").removeClass("notmandatory");
$(".aareinput").removeClass('skipmandatory');
}
</script>
<style>
```

## Related

- [Forms](/forms.md)
- [Form Fields](/form-fields.md)
- [About Form Fields](/about-form-fields.md)
- [Form Settings](/form-settings.md)
