For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
      • Element Presets
      • DOM Elements
      • Strings
      • Components
      • Slots
      • Headings
      • Images
      • Links
      • Forms
        • Get Form Name
        • Set Form Name
        • Get Form Settings
        • Set Form Settings
        • Form Inputs
          • Get Required Field Status
          • Set Required Field Status
          • Get Input Name
          • Set Input Name
          • Get Input Type
          • Set Input Type
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • Variables & Collections
    • Variable Collections
    • Variables
    • Variable Modes
  • Assets
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • formInput.getRequired()
  • Syntax
  • Returns
  • Example
  • Designer Ability
ElementsElement Types & MethodsFormsForm Inputs

Get Required Status

Was this page helpful?
Previous

Set Required Status

Next
Built with

formInput.getRequired()

Retrieves the required status of a form input.

This method is applicable to the following form input types:

  • FormCheckboxInput
  • FormFileUploadWrapper
  • FormRadioInput
  • FormSelect
  • FormTextarea
  • FormTextInput

Syntax

1formInput.getRequired(): Promise<boolean>

Returns

Promise<boolean>: Boolean - A promise that resolves to the required status of the form input.

Example

1const selectedElement = await webflow.getSelectedElement()
2
3const formInputTypes = [
4 'FormCheckboxInput',
5 'FormFileUploadWrapper',
6 'FormRadioInput',
7 'FormSelect',
8 'FormTextarea',
9 'FormTextInput'
10];
11
12if (selectedElement?.type && formInputTypes.includes(selectedElement.type)) {
13
14 const required = await selectedElement.getRequired()
15 console.log(required)
16
17} else {
18 console.log("Selected Element is not a Form Input Element")
19}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny