Set required field in CMS collection only *if* an other field is filled

Scenario: Imagine a blog layout which has a featured blog at the top with a large hero image, then other normal blog posts underneath that don't have any image at all (just text). In the CMS I add a Featured switch, and a Featured Image. Now, if the blog post is marked as Featured, then the Featured Image is a required field (can't have the hero blog post show with no image), but if the blog post is a normal blog post, then the featured image is not required.

Having some type of ability to dynamically set required field would be very handy.

  • Overlay
  • Apr 19 2018
  • Reviewed
CMS
  • Mitch McQuinn commented
    February 12, 2023 22:18

    5 years later... I wish this was a thing already

  • Dusty Strings commented
    August 27, 2021 17:32

    We could really use this as a way to make sure the layouts and functionality are preserved, but to avoid forcing unnecessary or made-up data entry.

    Additionally, we'd love the ability to conditionally show and hide a field based on the state of another field. In Overlay's example, it would be even more awesome if the the image field wasn't even visible for a non-featured blog post. We're ending up with dozens of fields that all have "If x scenario, just ignore this field" in the help text, and it's getting ridiculous. It would be nice to be able to hide extraneous fields so the client doesn't worry about what to enter in the fields that clearly don't apply to their situation.

  • מאיר רביב commented
    August 26, 2019 06:56

    Great IDEA! 

  • Admin
    Webflow Team commented
    August 03, 2018 23:30

    Hi there,

    Thanks for the clarification.  This is actually an idea we may be able to work on.  For now, I'll place this in our "backlog".

    Cheers,
    Nelson

  • Overlay commented
    July 31, 2018 02:35

    Hey Nelson, thanks for responding, although your suggestion doesn't solve this problem and perhaps my initial scenario description wasn't clear enough.

    My request is specifically around the CMS and management of a client. The whole point of setting a field as required is to ensure a certain level of quality and consistency in an environment where the client can post pretty much anything they want (blogs for instance). That's why in the above scenario you would definitely want to "force" the client to upload a photo for any featured blog post.

    However, in situations where no image is required (in the above scenario that means any standard, non-featured blog post), it seems redundant and unnecessary to force the client to upload an image for every single blog post only for it to not be displayed.

    Of course there are workarounds for this at the moment. You could simply make the image field mandatory (annoying for the client). You could make the image field non-mandatory and just constantly double check there are no "blank" featured posts, ruining the design of the page (annoying for the designer). Or you could create two seperate CMS collections, one for standard blogs and one for featured (removes the ability to quickly change a blog post from standard to featured, again annoying for the client). However I do hope that a better and smarter solution gets implemented one day.

  • Admin
    Webflow Team commented
    July 30, 2018 20:44

    You can just set all fields to not be required, then use the conditional visibility in your design:

    https://university.webflow.com/article/conditional-visibility

    - Nelson, Customer Success Specialist

  • +3