[SOLVED] Required when publishing does not validate on updates

I’m submitting a…

  • [x] Bug report

Current behavior

When a field is configured with:

"isRequired": false,
"isRequiredOnPublish": true,

It does not allow publishing when this field is empty – all good. However, once published, it allows to empty the field – which it should not.

Expected behavior

isRequiredOnPublish should work much like isRequired except that it enforces it when a document is being published or is already published.

This is a very unfortunate bug for us because we want to ensure that published documents maintain their required fields. Otherwise “Required when publishing” is kind of useless.

Minimal reproduction of the problem

  1. Create a field and mark it as “Required when publishing”.
  2. Go to any document that is already published and unset that field.
  3. Save the document.
  4. See that it allows you to do that, but it should not.

Environment

Self-hosted with docker
Version: [5.6.0]
Safari (desktop)

Indeed, I think this is an open gap that you have found.

But actually the wording makes sense right now :wink: … but I think your behavior is more correct.

You are right, current wording does make sense. But I think the intention of [IMPLEMENTED] Enable different validations for “Draft” and “Published” content might have been different.

Any chance this is going to be worked on soon? If not, we might be able to help with a PR, but I’m not sure which direction you want to go with this – reword or add a complementary setting.

Check out dev-5798 if you want.

1 Like

That was fast :grinning:

1 Like

This topic was automatically closed after 2 days. New replies are no longer allowed.