Try our conversational search powered by Generative AI!

restrict url property to allow internal and external links


I want url property to allow internal pages or external links only. I do not want media files(images) and email option to be available. 

public virtual Url geturl {get; set;}

Jun 06, 2016 21:49

Easiest way is to implement IValidate interface and not allow editors to save those kind of links. Customizing dojo interface takes a bit more work.

Depends on how much time you like to spend. Hours or a few days...

You can read more on custom validation here

Jun 06, 2016 22:36

when we try to set the url property, we have options like page, media, email and external. I just want to restrict it to appear page and external only.

Could we not use AllowTypes attribute. I could see examples using AllowTypes for ContentArea, could we not use the same for url?

Jun 06, 2016 22:50

Haven't tried it but don't think that would work. You can check this blog for how to play with EditorDescriptors if want to customize the dojo interface

But as I said...implementing IValidate will be far easier :)

It won't hide the buttons but will make it impossible for editors to save content that contains offending links...

Jun 07, 2016 8:32
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.