I'm trying to find a way to prevent the Publish action from happening on a custom property editor in Umbraco 7, when there is a validation condition set.
e.g. in my angular controller i've got a simple global boolean for hasError - when that is true, I don't want the user to be able to Publish the page but rather want a validation message to show if they hit Publish.
There doesn't seem to be anything in the official documentation about how to do this, or at least I haven't found it.
Is there an event we can subscribe to in the JS and return false, or call a preventDefault or stopPropagation on, in order to stop the Publish action from happening?
Or some other method provided by the umbraco angular framework we should be using.
Umbraco 7 property editor - custom validation, prevent Publish
Hi all,
I'm trying to find a way to prevent the Publish action from happening on a custom property editor in Umbraco 7, when there is a validation condition set.
e.g. in my angular controller i've got a simple global boolean for hasError - when that is true, I don't want the user to be able to Publish the page but rather want a validation message to show if they hit Publish.
There doesn't seem to be anything in the official documentation about how to do this, or at least I haven't found it.
Is there an event we can subscribe to in the JS and return false, or call a preventDefault or stopPropagation on, in order to stop the Publish action from happening?
Or some other method provided by the umbraco angular framework we should be using.
Any help appreciated!
Hi Chris,
have you ever found a solution for this problem? Facing the exact same issue.
Thanks,
Christian
I have done it this way.
I created a hidden field with a required attribute.
Then in my angular controller I have function that I call that fills this field when my editor is valid. If it's not valid I leave it empty.
That should do the trick
Dave
Nice! That did it for me
Great solution! Thanks for posting!
is working on a reply...