Skip to main content

Automatic Show and Hide of Fields

Last updated 20/12/2021

With the relationship established at the table-level, Five will automatically remove the foreign key field when the form is in the stack.

Example

In the below example the Vendor table has a foreign relationship with the Catalog table. A vendor can have many catalogs.

Foreign Relationship Established at the Table-Level
Figure 1 - Foreign relationship established at the table-level

At the form-level, a form is made for both of the tables. The Catalogs form holds the VendorKey field and the field is required to have a value.

VendorKey Field on the Catalogs Form
Figure 2 - VendorKey field on the Catalogs form

Scenario One

A menu item is created to reference the Catalogs form. The Catalogs form is at the top-level so the foreign key field VendorKey is available on the form allowing you to select the vendor who the catalog belongs.

Vendor Field is Available on the Catalogs Form
Figure 3 - Vendor field is available on the Catalogs form

Scenario Two

The Catalogs form has no menu item created and is attached as a list page on the Vendors form. Navigating to the Catalogs sub-form on the Vendors form, the foreign key field VendorKey is not visible on the Catalogs form. Five automatically removes the field in this scenario as the vendor involved is already known.

Vendor Field is unavailable on the Catalogs Form
Figure 4 - Vendor field is unavailable on the Catalogs form

Scenario Three

The Vendors menu item is the parent menu for the Catalogs form. This will require you to select a vendor and drill down to the Catalogs form. Five automatically removes the field in this scenario as the vendor involved is already known.

Vendor Field is unavailable on the Catalogs Form
Figure 5 - Vendor field is unavailable on the Catalogs form