Make A Field Required Based on Value of Another Field

Support MB Builder Make A Field Required Based on Value of Another FieldResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #40820
    James CooperJames Cooper
    Participant

    Can I make a field required based on the value of another field?

    For instance, if I have a select box that allows a choice of celebrity roles as they relate to the production of a movie like so:
    Actor
    Actress
    Director
    Writer

    And I have a post field for selecting a Character.

    How can I make the 'Character' field required if 'Actor' or 'Actress' is chosen in the select field? And not make it required otherwise?

    Best Regards,

    Ryan

    #40822
    James CooperJames Cooper
    Participant

    Never mind, I realized that using conditional logic to hide the field unless the options that make it required are chosen works how I want it to.

    For future reference, given my example above:

    Making the 'Character' field required and setting the conditional logic to display the 'Character' field only when 'Actor' or 'Actress' is chosen in the select field makes the 'Character' field required only when 'Actor' or 'Actress' is chosen.

    This allows the post to be successfully saved when 'Director' or 'Writer' is chosen, but no 'Character' has been set (because even though the field is set to required the field is hidden and, therefore, not required in this instance).

    If 'Actor' or 'Actress' is chosen, then the 'Character' field is displayed and requires a value for the post to be successfully saved.

    Hope this helps anyone searching for this functionality in the future.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.