Validation not triggered on draft save #2807
Replies: 3 comments 3 replies
-
Hey @christoph-reps — this is actually by design. Because drafts can be saved in an unfinished state, saving a draft does not enforce validation. We have discussed potentially building a flag to enable validation for drafts, therefore removing the ability to save an incomplete draft, but this would be a new feature that would be opt-in. What do you think? I'll convert this to a Feature Request discussion and we can keep the conversation going there! |
Beta Was this translation helpful? Give feedback.
-
Hey, making it configurable would be a good solution. I think it depends of once workflow. If you create big pages with lot of fields you might want to be noticed about limitations earlier than just before the publish since you don't know the limitations while you create the pages. As the docs mentioned we could write a function for the description to notify the user how much characters are left but that would elaborate if you have to write it for all fields. So I think a builtin notification for min / max limitations would be nice. |
Beta Was this translation helpful? Give feedback.
-
Can anybody point me to the spot where I can enable validation in drafts? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Link to reproduction
https://github.com/christoph-reps/payload/tree/validate-length-with-draft
To Reproduce
Describe the Bug
Savings drafts seems to not trigger validation.
If you create a post and publish it validation will be triggered.
This is not the case when you save it as a draft.
I guess as a user i would expect both buttons to behave the same for validation. Or thought a bit further builtin validation for min / max character fields should trigger onChange or onBlur for text fields
Payload Version
1.8.5
Beta Was this translation helpful? Give feedback.
All reactions