Property value editor messages are not s...
# package-development
a
hi all, I am trying to add my own custom client-side validator (for the block grid) in the backoffice but have some problems with it. I have successfully added the validator and it validates the input information in the property editors, but my main issue is that it does not display the validation message, just the "error" icon besides the editor (see the image). I asked this question before, but had to switch over to something else, before coming back to this issue. The reply was mentioned here: https://github.com/umbraco/Umbraco-CMS/issues/17764#issuecomment-2609846119 that the messages are only displayed in a form control. I tried using a Textbox and Numeric built-in property editors which are the form controls but the messages would still not display. I feel like I am missing something. Most likely, it's not enough to add an error message through the validation context, something else must happen for that error message to be visible in the form control. If someone could point me in the right direction, that would be fantastic (or maybe it's not possible what I am trying to do). Thanks! https://cdn.discordapp.com/attachments/882984798719729704/1359904701566554284/393894794-151e924c-22d1-4ffb-bd6f-4b03bb9023b4.png?ex=67f92d72&is=67f7dbf2&hm=227f394fc1d0fdc6829418a859c854ea98ad49ee8b5019904191f768151131bf&
I compared how error message is displayed for the Server Side Validation.
umb-form-validation-message
shows the validation messages, only if the control is invalid (on a custom invalid event) and if it's not pristine. But the way I am adding messages through the validation context does not make that control invalid (it does not pass the message into it just marks the property editor element as invalid which displays that "danger" icon). so, instead of adding a validator into the validation context, I need to somehow add a validator inside that form component/control via
addValidator
function. but I don't think there is a way to get the control by its alias through any of the contexts, not sure. just a bit for a context: I could create a server side validation for it, but I'd like to display an error message in a property editor by its alias (if possible) when user presses Submit in the Block Workspace Editor.
This is a bit strange, but I found a way to do this. Instead of "client" in`validationContext.messages.addMessage("client", ...)`, I could have used `server`:
validationContext.messages.addMessage("server", ...)
. Which would pass down the validation message to a form control because of a
UmbBindServerValidationToFormControl
that is being set for the form control element. This is a bit unintuitive. I would expect the data paths to work for the "client" as well, but it's just my assumption.
now I need to find a way to reset all my custom messages when "Close" is pressed.
an interesting thing that I found is that for "server" messages there are two the same validation messages added, not sure why. they even have the same path. though, one is server and another one is client https://cdn.discordapp.com/attachments/1359904701386068051/1360036340158431294/image.png?ex=67f9a80b&is=67f8568b&hm=bfd42cc463e5e72986504893f723080ea515f380661cd0bdd3fb5e10e67b7c7e&
4 Views