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.setRequired(value)
  • Syntax
  • Parameters
  • Returns
  • Example
  • Designer Ability
ElementsElement Types & MethodsFormsForm Inputs

Set Required Status

Was this page helpful?
Previous

Get input name

Next
Built with

formInput.setRequired(value)

Sets 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.setRequired(value: boolean): Promise<null>

Parameters

  • value: Boolean - The required status of the form input.

Returns

Promise<null>

A Promise that resolves to null.

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 await selectedElement.setRequired(true)
14
15} else {
16 console.log("Selected Element is not a Form Input Element")
17}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canEditAnyAnycanvasAny