Version:

    Hidden input form element

    Use the Hidden input form element to add a hidden field to your component form. You can use the Hidden input form element with conditional visibility to apply data when a condition is true.

    Example

    As an example, you could use the hidden input field to apply a CSS class with color: white to a paragraph element when a color picker field applied to the background of an outer container has the value of #000000. The result would be when the user of the component selects black as the component background color, paragraph text within it will turn white. 

    Locating the hidden form element

    To find the Hidden form element:

    1. Navigate to a component
    2. Click the + button on the Component form builder
    3. Within the Fields tab, look for the Hidden form element.

    The Hidden form element includes the following fields:

    Field name

    • Field label - Provide a name for the form element. It will be used to auto-generate the field machine name. Auto generation only occurs until you have clicked Apply.
    • Machine name - Set the machine name of the field. Used as a token when linking an element to the field. Must be unique within the component. Important: If you need to change the machine name later, click the Edit icon on the field's right.

    Field settings

    • Value - The value of the hidden input.

    Escape HTML

    • Escape - When toggled on, this will escape any HTML that is input into the field by the site editor and output as plain text. This is turned on by default.

    Visibility

    DX8 knowledge base icon

    Frequently asked questions

    Get instant answers to common questions. Available online 24/7.

    Find answers

    Raise a ticket icon

    Raise a support ticket

    To raise a ticket, sign into Acquia Cloud and select Help in the top menu.

    Raise support ticket

    Acquia

    Copyright © 2020 Acquia, Inc. All Rights Reserved. Drupal is a registered trademark of Dries Buytaert.