Trigger Validation on Change of status from Draft to Publish

I have some validation rules in schema which automatically get triggered when we try to create/update but some user able to bypass that by using “Change of Status”. Is there way to trigger validation during Change of Status (i.e. from Draft to Published)?

No, the validation usually only trigger when the content is changed.

But I do not understand how they are able to bypass the validation.

If we chnage status from right pane as below, it does’t trigger validation.

Yes, I understand that, but it also does not change the content, so it does not bypass validation.

I wanted to make sure some fields gets populated before content gets published. Is there a way I can trigger validation when this change occurs? Some kind of Post script ?

No, it is not possible. You can convert this topic to a feature request if you want.

Thanks, I will submit this as New Feature Request.

Now, I also have this requirement but haven’t found the feature request.

I found another similar post Published date property or published date in the past - Support - Squidex Support, and it inspired me to use the following method to capture state changes.

        var data = ctx.data;
        
        if (data.published) {
                if (ctx.status === "Published") {
                    data.published = { iv: true };
                } else {
                    data.published = { iv: false };
                }
                
                replace(data);
        }