3 minutes reading time (606 words)

Adding Custom Fields to the Joomla Contact Form

Adding Custom Fields to the Joomla Contact Form

This tutorial explains how to add extra fields to the Joomla Contact form using Custom Fields. The process uses core Joomla functionality, requires no third-party extensions, and is fully upgrade-safe.

You’ll learn how to create a field, configure permissions correctly, control where it appears on the form, and ensure submitted values are included in the contact email.

Step 1: Create a Custom Field

We’ll begin by creating a Custom List Field that allows the site visitor to select the type of enquiry they are making.

  1. Go to Components → Contacts → Fields
  2. Select Mail from the context dropdown
  3. Select New
  4. In the General tab, configure the field:
  • Title: e.g. Enquiry Type
  • Type: List (set this first)
  • Required: Optional
  • List Values: Add Text / Value pairs for each option

Select Save & Close.

Why set the type first?
Several configuration options depend on the field type. Selecting List first ensures all relevant settings are available.

Selecting the mail context

Creating a new Contact custom field

Step 2: Change Field Permissions (Critical)

By default, custom fields do not allow unauthenticated users to submit values. Since contact forms are typically used by public visitors, this permission must be adjusted.

  1. Edit the custom field
  2. Open the Permissions tab
  3. Locate Edit Custom Field Value
  4. Set Public to Allowed
  5. Save the field

If this step is skipped, the field may appear on the form but guest users will be unable to select or submit a value.

Custom field permissions

Step 3: Position the Field on the Contact Form

Next, define where the field appears in the Contact form layout.

  1. Edit the custom field
  2. Open the Options tab
  3. Set Display to:
  • After Display (recommended), or
  • Before Display, depending on your layout

You may also set optional styling values such as Label Class and Field Class.

Save the field when finished.

For precise control over field placement, select Do not Automatically Display and create a template override for default_form.php in the Contact component.

Step 4: Check the Frontend Form

Verify how the field appears to site visitors.

  1. Open the Contact page on the front end
  2. Confirm the field is visible
  3. Confirm a guest (non-authenticated) user can select a value

Contact form showing the new custom field

Step 5: Confirm the Email Includes Custom Field Values

Finally, confirm that submitted values are included in the contact email.

  1. Submit the Contact form
  2. Open the received email
  3. Scroll below the main message content

Custom field values should appear automatically under a Custom Fields section.

If the values are missing, check the following:

  • The field was created in the Mail context
  • Public users are allowed to edit the field value
  • System → Mail Templates → Contacts: Contact Form Mail includes the {CUSTOMFIELDS} placeholder

Contact email template

Submitted email

Common Problems & Fixes

  • The field appears but values are empty in the email
    Ensure Edit Custom Field Value is allowed for the Public user group.
  • The field does not appear on the form
    Confirm the field was created in the Mail context and is published.
  • The field appears but cannot be selected
    This is almost always a permissions issue. Recheck Step 2.
  • Custom fields are missing from the email
    Edit the contact mail template and ensure the {CUSTOMFIELDS} placeholder is present.

Summary

  1. Create a custom field using the Mail context
  2. Allow Public users to submit values
  3. Choose how the field is displayed
  4. Verify the frontend layout
  5. Confirm values appear in the email

Using Custom Fields keeps your Contact form flexible, upgrade-safe, and fully Joomla-native.

Tip: For advanced layouts or conditional logic, combine Custom Fields with a Contact template override.

Some articles published on the Joomla Community Magazine represent the personal opinion or experience of the Author on the specific topic and might not be aligned to the official position of the Joomla Project

0
The January Issue
 

Comments

Already Registered? Login Here
No comments made yet. Be the first to submit a comment

By accepting you will be accessing a service provided by a third-party external to https://magazine.joomla.org/