What should happen with custom validation on Media Type properties? #18047
marcemarc
started this conversation in
Features and ideas
Replies: 1 comment 1 reply
-
Oddly enough we were discussing this the other day at HQ, as part of the resolution of #17932 via #17961. We did wonder if it would be better to just fail the save here. We left as is though mainly due to the challenge of the "drag/drop" behaviour. It could be that editors have a workflow where they drag and import a number of media files in one go, so the media is created, and then they go through and add the mandatory alt text or other properties. If we prevented save on validation, then they would no longer be able to do that. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This came up recently in a consultancy call, as Umbraco 13 was throwing an error when setting custom validation on a Media Type property whereas in V8, a validation message was displayed - in both cases the Media item was saved, but it led to the question of what was the point of being able to specify a regex to validate Media Type properties to a particular pattern - when they don't prevent anything from happening, if the provided text is invalid.
When you apply a custom validation restriction to a Content Item, then it is the 'Umbraco way' to allow you to save the content item with the validation error, but not publish, if the field is 'mandatory' then it does need to be filled in to enable it to be saved.
But with Media Types there is no concept of a 'published state'... as soon as the Media item is saved it is available on the front end of the website along with any change to associated Media Type properties, whether they are valid or not, according to the custom validation rules.
In the conversation, the aim was, to prevent a hyphen from being entered into a description of the Media Item, as this was breaking their search implementation, and the advice was to use the MediaService Saving notification to handle the enforcement of the rule.
However, it made me wonder why we had the UI for the Custom validation at all for Media Types...
Would it be more expected that for Media Types, where there is no publish state, that the custom validation prevents saving? or does that create an inconsistent editorial experience with the way content works? or should we just not have the 'custom validation' for Media Types as it doesn't really do anything, but leads people to believe that it might be enforcing something? in 13 a red banner would be shown, but in 15.1.1 nothing is shown the Media is just saved...
genuinely didn't know what should happen :-P
Beta Was this translation helpful? Give feedback.
All reactions