Tip: Setting a field as "Required" in Webform's UI won't enforce it if the field is hidden by conditional logic. To ensure it’s required only when visible, leverage Webform’s built-in “Required if” condition, or implement a custom validator for more control

Example: Using “Required if” in Webform UI

Suppose you have a checkbox field named "Use API" (api) and a textfield "API Key" (appid). You want the API Key field to appear and be mandatory only when “Use API” is checked.

In Webform’s UI:

  1. Add a Condition under the Conditions tab.
  2. Configure the Target component as "API Key".
  3. Set it to "Show and require" when "Use API" is checked.
  4. Save the condition.

This way, “API Key” is both visible and required only under the specified condition—streamlining user experience and data validation.
This pattern works intuitively with Webform’s conditional logic.

Knowledge base

Category

How would you rate this page?

Please note feedback is not actively monitored and will not receive a direct reply.