I have reviewed various help topics, documentation, and the source code to try and determine how I can create both client-side and server-side validation for a custom property editor. I built a custom property editor for creating a custom URL in previous versions of Umbraco (v7 to v13) in AngularJS, along with C# for the server-side validation. I am having an issue with determining how to do the same using v16 of Umbraco with Lit and the UUI library. I found the following documentation:
Property Editors - Integrate Validation
I need to submit the value of my property editor (a custom URL), as well as an optional GUID for the current node being edited (which will be null if I’m dealing with a new content item).
It appears in my constructor, I need to get a reference to UmbValidationContext. I then need to wrap my custom URL property editor (which just uses a ) in a tag, and have ${umbBindToValidation(this)} on my along with a #validate method on my custom Lit element. I can then use a modal context to display an error message, along with the inline error.
How do I go about having an async method called to send the custom URL, as well as the entity GUID, to the server? What type of controller do I use in C# on the server-side to accept this data, and do I just use the native fetch method to call the validation, or is there a better way to go about this?
I have the custom URL value, as well as the entity ID, after consuming the UMB_ENTITY_DETAIL_WORKSPACE_CONTEXT and calling .getUnique() on the context (and this.value carries the custom URL from the TextBox). I understand using the Notification Context to display any errors, as well as using the , but I’m also wondering how I can create server-side validation in case my user doesn’t click a “Validate URL” button. I see the documentation at:
Property Editor - Adding Server-Side Validation
I apologize for such a lengthy post. I have been going through the documentation, source code, and help topics such as:
Property Editor: How Do I Use Validation?
This has really been the issue that has prevented me from moving nearly 90+ Umbraco websites to the latest version of Umbraco. I am in talks with my employer to release this Custom URL property editor under an open-source license so anyone can make use of it. I have a Cloudflare caching plugin written in AngularJS that will also be able to take advantage of this knowledge if I’m able to get this working, to clear the cache of a specific page, any listed URLs, or the entire site cache.
I appreciate any and all help with this issue.