Skip to main content

Field codes

The short answer​

What is a field code, and is it safe to change? The Field Code is a field's short name, such as workshop. It isn't shown on the form, but it can appear in links and in the page's code, so keep it free of private information. Your emails, email conditions and other tools use it to find the field's answer.

When you rename a code and publish the form, WebForms updates the places inside the form that use it. Places outside the form keep the old code and stop working until you change them yourself.

How it works​

Where the code is​

The Field Code box is on the General tab of the field, in the Basic group, under Label. When you add a field, the builder makes a code from the label in small letters, with underscores between the words. The code must start with a letter and may hold letters, digits, underscores, hyphens and colons. Two fields of one form can't share a code.

The note under the box says the code is used by templates, by URL prefill, by the API and in a CSS class.

What updates when you publish a new code​

A renamed code changes in the draft first. Your live form, its emails and their conditions keep the old code until you click Publish Changes. On publish, WebForms rewrites the code wherever the form itself uses it:

  • Email conditions. A notification condition shows the field's label with its code in brackets. After the rename it shows the new code.
  • Recipients from a field. A notification sent to the contact the visitor chose in Nearest workshop keeps working, and the setting shows the new code.
  • Answers in email text. An answer placed in a notification's message by its code changes to the new code.

These three are the notifications of this form, on its Notifications tab. All three were checked on a test store.

  • Show and hide rules. These point to the field itself, not to its code, so a rename doesn't touch them.

In a test, a submission sent right after the rename still matched the condition and went to the chosen workshop.

The same rewrite covers the text and conditions of the form's confirmations and the conditions that decide when a PDF document is added. The text of a PDF document isn't rewritten: if it quotes an answer by the old code, change it yourself.

What does not update​

While you type a new code for a published field, the panel warns you: "Renaming a published code breaks what already quotes it", and lists these places:

  • email and PDF templates kept outside the form's own notifications, such as templates you or a developer wrote in an older format that quote the answer by its code;
  • links that fill in the field from the web address, which name the field by its code;
  • the CSS class made from the code, used by your theme's styles;
  • the customer registration mapping;
  • other systems that read submissions through the API.

Earlier submissions keep their answers. A submission sent before the rename still shows its What needs repair? answer in the Inbox.

What a reserved name means​

Some codes mean something to WebForms or to Magento beyond naming the field. The panel then adds a second line that starts with Reserved name. It is a warning, not an error: the code is saved anyway. There are three kinds:

The code is… The panel says What it means for you
A customer account detail, such as email or firstname "This code matches a customer attribute, so the answer would be mapped onto it." If the form registers customers, this answer can fill that account detail.
name, firstname, lastname or middlename "This code makes the field a source of the submitter name shown in the inbox." The answer becomes the name the Inbox shows for the submission.
A name WebForms uses for submission data, such as id, field or field_ followed by digits "Submission data already uses this key, and a field code would overwrite it." Pick another code.

A field whose label is a reserved code gets that code with _field added at the end: an Email field you drag onto the form gets email followed by _field, and a Name field gets name followed by _field. These codes carry no warning.

What this means for you​

  • Choose codes before you publish the form for the first time, and keep them after that.
  • Before you rename a published code, check your email templates, prefill links, theme styles and connected systems for the old code.
  • After a rename, click Publish Changes. Until then, emails and conditions still use the old code.
  • Keep a code with Reserved name only when you want the effect the panel describes.

What's next​

Applies to WebForms 4Last reviewed October 14, 2026