Stop umbraco from automatically add (1) to conflicting page names
When the editor accidentally creates a new page with the same name as another page Umbraco adds (1) to the page name without even mentioning it to the editor.
Is there any way to stop that and trigger a validation error instead?
think you could hook into the saving event and then look up for duplicate names. When found cancel The saving with a message that this page already exists.
A good idea but I can't seem to cancel the event (the e.CancelOperation throws an exception since it can't be cancelled) or send a message back to the editor.
Since its possible to have validation even with regexp on regular fields it would be nice to have for page name too.
I'll look into the events more tomorrow, perhaps I've missed an event that can be used.
Stop umbraco from automatically add (1) to conflicting page names
When the editor accidentally creates a new page with the same name as another page Umbraco adds (1) to the page name without even mentioning it to the editor.
Is there any way to stop that and trigger a validation error instead?
Hi Tommy,
think you could hook into the saving event and then look up for duplicate names. When found cancel The saving with a message that this page already exists.
Currently on mobile so can't provide sample.
Regards David
You can add
EnsureUniqueNaming
toumbracoSettings.config
and set it to false: https://our.umbraco.org/documentation/reference/config/umbracosettings/edit - ah okay, no error in that case, go with an event then like David says
Hi David,
A good idea but I can't seem to cancel the event (the e.CancelOperation throws an exception since it can't be cancelled) or send a message back to the editor.
Since its possible to have validation even with regexp on regular fields it would be nice to have for page name too.
I'll look into the events more tomorrow, perhaps I've missed an event that can be used.
Hi Tommy,
what event did you use? As there is an event for saving and one for saved. The one you have to use is saving.
Then you only have to set e.Cancel to true.
I try to get some sample working tomorrow.
Regards David
is working on a reply...