Hiding properties/elements on episerver forms

Vote:
 

Hi i want to hide default episerver form elements or specific properties on default elements that i dont use in edit mode, any way to go about this?

Best regards Jonas.C

#148549
May 17, 2016 9:37
Vote:
 

I don't know how to do it with code since I haven't worked with Episerver.Forms, but since they are just blocks, you should be able to uncheck the "Available in edit view" option in Admin.


#148554
May 17, 2016 10:31
Vote:
 

Excellent, this worked. I tried going about it with code first but without success hehe

#148555
May 17, 2016 10:56
Vote:
 

Just remember that you will need to do this in all envirnoments(test/stage/prod) so it's better to do it with code, but I don't know how/if it's possible right now.

#148556
May 17, 2016 10:58
Vote:
 

Yeah thats why i wanted to do it with code in the first place.. but this is better then not being able to disable them at all :) 

#148557
May 17, 2016 11:00
Vote:
 

This should work

var contentTypeRepository = ServiceLocator.Current.GetInstance<IContentTypeRepository>();
var type = contentTypeRepository.Load(typeof(TextareaElementBlock));
type = (ContentType)type.CreateWritableClone();
type.IsAvailable = false;
contentTypeRepository.Save(type);



#148559
May 17, 2016 11:37
Vote:
 

Great! Thanks Yauheni :)

#148566
May 17, 2016 13:28
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.