Im creating a custom propertyeditor with a few prevalue fields. One of them is a number field that i need to be required. I´ve managed to add the validation type "Required" and it works just fine (the editor cannot be saved without a number value) but i want to show my custom errormessage. What do i add to get this?
This is my prevalue field:
fields: [
{
label: "Max number",
description: "Max number.",
key: "maxNumber",
view: "number",
validation: [
{
type: "Required",
errorMessage: "Custom message", <-- Did not work
errorMsg: "Custom message", <-- Did not work
message: "Custom message", <-- Did not work
}
]
},
All the above gives me this generic error message:
Could you perhaps share your current code on a Github gist for instance? it will make it a bit easier to understand the full context of your issue. I get that you need to be able to display a custom error message defined in the package.manifest but getting the full context will make it easier to test the code on a local instance of Umbraco and figure out if this might be a bug that needs to be addressed or if it's better and more desirable to make a workaround where you do the validation in the controller yourself by hooking into the notificationService for instance.
Custom validation for prevalue fields
Hello Umbracians. I have a problem.
Im creating a custom propertyeditor with a few prevalue fields. One of them is a number field that i need to be required. I´ve managed to add the validation type "Required" and it works just fine (the editor cannot be saved without a number value) but i want to show my custom errormessage. What do i add to get this?
This is my prevalue field:
All the above gives me this generic error message:
Hope anyone can help!
Great thinking Dennis, posting a thread on a weekend.
I keep forgetting that other people have lives..
Ever figure this out? I am having the exact same problem.
Hi Peter
Could you perhaps share your current code on a Github gist for instance? it will make it a bit easier to understand the full context of your issue. I get that you need to be able to display a custom error message defined in the package.manifest but getting the full context will make it easier to test the code on a local instance of Umbraco and figure out if this might be a bug that needs to be addressed or if it's better and more desirable to make a workaround where you do the validation in the controller yourself by hooking into the notificationService for instance.
Looking forward to hearing from you.
/Jan
is working on a reply...