Netlify-cms: Don't enforce required fields for saving drafts

Created on 27 Jun 2017  路  9Comments  路  Source: netlify/netlify-cms

I think this is divergent from any CMS I've used - fields should be optional unless configured as required. Adding this to the 1.0 milestone, but let's discuss.

validation feature pinned

Most helpful comment

@erquhart I'm with you on this - it's very unnatural and leads to use of a lot of placeholders, particularly since we currently enforce required fields even when saving a draft, so you can't save your work without filling out all the fields.

All 9 comments

@erquhart I'm with you on this - it's very unnatural and leads to use of a lot of placeholders, particularly since we currently enforce required fields even when saving a draft, so you can't save your work without filling out all the fields.

All fields in Webpop were required by default.

For all the actual integrations I've done of the CMS, I would say that the vast majority of fields tend to be required before a post is ready to go live.

The main issue is around drafts where it's really annoying not being able to save before all fields are filled out. The issue with allowing drafts without required fields, on the other hand, is that missing fields can often break the build.

That might still be an acceptable tradeoff though...

I think folks are more used to the big CMS's, where fields generally aren't required by default, eg. Wordpress. Allowing drafts to save without required fields would probably help, but I still think the expectation is that fields are only required if they're configured to be required.

Weird. I did not expect to be able to publish a WordPress post with no title, body, or anything. Had to test it for myself鈥攃onfirmed!

Definitely feel they should not be required unless explicitly set

@biilmann I'm thinking we'll do this in 1.0, but with an additional fieldsRequiredByDefault flag in the config that can switch it back, both to ease migration and for folks who just want it that way. That should cover our bases pretty well.

(We'll also note it as a breaking change in the release notes.)

@erquhart I like that approach a lot. The option to switch it back is a good idea.

Actually, I need to update this after a productive discussion with @biilmann about why people want this.

The concept broke down to:

  • People want fields optional by default for creating drafts
  • People generally don't want fields optional for publishing

So the new approach is to simply warn on empty required fields (except title I guess) for drafts, but to disallow publishing if required fields are empty. I think it's a solid plan.

This can be implemented pretty simply for the editorial workflow, but won't be available for the simple flow until draft functionality is added there. Which, side note, probably means the simple workflow will start working the same as editorial, except there's only unpublished and published.

Note that everything we're talking about here is post-1.0.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikecrittenden picture mikecrittenden  路  3Comments

ghost picture ghost  路  3Comments

tech4him1 picture tech4him1  路  3Comments

BerkeleyTrue picture BerkeleyTrue  路  3Comments

chriskirknielsen picture chriskirknielsen  路  3Comments