Formcrafts - a form and survey platform for Salesforce, HubSpot, etc
  1. Templates
    1. All templates illustration
      All templates
    2. Application forms illustration
      Application forms
    3. Calculation forms illustration
      Calculation forms
    4. Lead generation forms illustration
      Lead generation forms
    5. Customer service illustration
      Customer service
    6. Evaluation forms illustration
      Evaluation forms
    7. Survey and feedback illustration
      Survey and feedback
    8. Operations forms illustration
      Operations forms
    9. Payment forms illustration
      Payment forms
    10. Booking and registration illustration
      Booking and registration
    11. Salesforce forms illustration
      Salesforce forms
    12. Other forms illustration
      Other forms
  2. Features
    1. 18 Form Fields illustration
      18 Form Fields
    2. 19 Integrations illustration
      19 Integrations
    3. Conditional Logic illustration
      Conditional Logic
    4. Multi-step Forms illustration
      Multi-step Forms
    5. Calculations illustration
      Calculations
    6. Partial Submissions illustration
      Partial Submissions
    7. Save & Resume illustration
      Save & Resume
    8. Payments illustration
      Payments
    9. Hidden Fields illustration
      Hidden Fields
    10. Dynamic Dropdowns illustration
      Dynamic Dropdowns
    11. Engagement analysis illustration
      Engagement analysis
    12. Multilingual forms illustration
      Multilingual forms
  3. Pricing
  4. Help
  5. Login
  6. Signup
    →
  • Help index
  • Features
    • Conditional logic
    • Prefill forms
    • Multi-step forms
    • Calculations
    • Partial submissions
    • Field references
    • Save and resume
    • Hidden fields
    • Dynamic lookup
    • Workflows
    • Dynamic dropdowns
    • Multilingual forms
    • Privacy mode
    • Success message
    • Form redirect
    • GA/GTM
    • Accept payments
    • Linked forms
    • Disable form
  • Styling
    • Custom CSS
    • Custom fonts
    • Color scheme
    • Form background
  • Analytics
    • Test mode
    • Overview
    • Field analytics
    • Form engagement
  • Workflows
    • Send emails
    • Form redirect
    • Success message
    • Webhooks
    • Create PDF
    • ActiveCampaign
    • Asana
    • Mailchimp
    • Front app
    • Freshdesk
    • Google Sheets
    • Pipedrive
    • Linear
    • Klaviyo
  • Sharing
    • Custom form link
    • Embed on a page (inline)
    • Embed on a page (popup)
    • Embed in emails
    • Embed on WordPress
    • Embed on Shopify
    • Embed on Squarespace
  • Salesforce
    • Overview
    • Create records
    • Update records
    • Related records
    • Dynamic picklists
    • Attach files
    • Create PDFs
    • Form prefill
  • HubSpot
    • Overview
    • Create contact form
    • Create lead capture form
    • Create customer survey
    • Prefill HubSpot form
    • Embed on HubSpot page
    • Uninstall
  • Zendesk
    • Create ticket form
    • Create CSAT survey
    • Embed on Help Center
    • Prefill ticket form
  • Admin
    • Users
    • Custom domain
    • Vanity subdomain
    • Subscription
  • Developers
    • Embed Library
    • API keys
    • API v1
    • API v2
  • Others
    • Partner program
    • GDPR compliance
    • Workflow logs
    • White labeling
    • Form speed
    • Zapier
    • Migration
  • Contact
  1. Help
  2. ›
    Features
  3. ›
    Hidden fields

Using Hidden Fields

On this page
  1. Introduction
  2. Adding a hidden field
  3. Setting the field value
  4. Use cases
  5. Debugging

Introduction

Hidden fields are powerful form elements that store and process data invisibly. These fields can help track users, personalize the experience, or automate backend operations—all without cluttering the user interface. In this guide, we will explore the numerous ways you can harness hidden fields to make your forms smarter and more efficient.

Hidden fields are a very powerful feature that can be used in a variety of ways:

  • Traffic source tracking (like storing UTM parameters)
  • User segmentation (like storing the product ID)
  • Personalization (like passing the user's name)
  • User Attribution (like storing the user email to associate a survey response)
  • Internal operations (like math calculations)

Adding a hidden field

You can add a hidden field via Add Field → Hidden on the form editor page. A hidden field has two configuration options: the label of the field, and the value.

Screenshot of adding a hidden form field in Formcrafts editor for source tracking and user segmentation.
Hidden field

When you click on the cog icon to edit the field you can see the field ID on the top-left corner. Note this field ID as we will use it below.

Setting the field value

Since the field doesn’t ask for user input, you can set the value of the hidden field in a few different ways:

Static value

This can be useful for setting fixed values like a version ID for internal tracking.

If you want the hidden field to always have the same value, you can simply type it in the value field when editing the field in the form editor.

A static value can be a simple string, like yes or no. It can also contain field references, like @Your name or @Email.

URL prefill

Useful for tracking user interactions from specific ads or campaigns by passing UTM parameters, or for personalizing the form by passing user data.

You can prefill a hidden field by adding a query parameter to the form URL. For example, if you want to prefill a hidden field with the value 123, you can add ?field4=123 to the URL.

When using URL prefill you can either use the field ID or the field label. If our hidden fields is labelled username you can use ?username=123 to prefill the field.

Here is an example of prefilling name and using that to personalize the form:

Browser mockup displaying a personalized form
Personalizing the form using hidden fields

Learn more about form prefilling here.

Calculated value

You can use math calculations in the value of a hidden field. This allows the hidden field to store the result of a math formula which can contain inputs from other fields.

Simple form showing math calculations via hidden field
Storing calculation results in hidden fields

In the above example we have two input fields, with the IDs field1 and field2. We are using a hidden field to store the sum of the two input fields. The value of the hidden field is set to {field1 + field2}.

Now if you want to reference the sum again (example in another rich text field) you can simply reference this hidden field, instead of having to use the math calculation in multiple places.

One good example to look at is our mortgage calculator form ↗, which uses hidden fields to calculate and store the Future value factor.

Conditional value

You can use conditional logic to set the value of a hidden field.

For example, saw we are building an approval form. In the backend we use the value of the hidden field labelled manual_approval to determine if the form needs manual approval.

Conditional logic step to set the value of a hidden field
Using conditional logic with 'set value'

In the above example, we are setting the value of manual_approval to yes if either of the two conditions are met:

  1. The Amount is greater than 1000.
  2. The Amount is greater than 500 and Request type is Initial.

Use cases

Let’s see how we can use hidden fields in a few different scenarios:

  1. Source tracking: If you are using UTM parameters in your form URLs, you can store the source data in hidden fields. Example, you can add hidden fields labelled utm_source, utm_medium, and utm_campaign to your form. These fields will automatically be filled with the UTM parameters from the URL.
  2. Segmentation: If you have several product pages on your website sharing the same contact form, you can add a hidden field to your form that stores the product ID (either via URL or our JS library). This way you can segment your leads based on the product they are interested in.
  3. Attribution: If you are running a survey campaign, you will send out a mass email to your subscribers inviting them to fill out the survey. This emails links to your survey, and the URL includes their email ID. You can use a hidden field to store the email ID, and attribute the survey response to specific users.

Debugging

While hidden fields are not visible to the user, you can still see them and their value when viewing the form in test mode. Test mode is accessed by clicking on Preview on the form editor screen. This can be useful for debugging purposes.

Here is our mortgage calculation form’s ↗ preview mode, showing hidden fields that store the future value and monthly amount:

Mortgage calculator form's preview mode showing hidden fields
Hidden fields in preview mode
Minimal, fast, and powerful. Try now.
Formcrafts - a form and survey platform for Salesforce, HubSpot, etc

Subtle Web Inc,
225 Railway St E,
T4C 2C3, Cochrane AB

Salesforce AppExchange partner logo HubSpot app partner logo
Templates
Application formsLead generation formsSurvey & feedback formsEvaluation formsSupport request formsBooking & registrationContact forms
Comparisons
vs AllFormAssemblyTypeformJotformWufooSurveyMonkey
Features
Conditional logicSalesforce formsHubSpot formsZendesk ticket formsEmail formsIntegrationsForm fields
Resources
Help centerBlogDeveloper APIGDPRStatusReport abuseContact us
Company
About usNonprofitCase studiesSecurityTerms and privacy