Hide field or make them readonly

Is it possible to hide field from editors or make them readonly?
If yes, how?

Litium version: 7.6

There a couple of options.

  • The field doesn’t have to be in a field template in order to use it programmatically, so you could just not add it to a template and it won’t be visible when the editor is editing the entity.
  • The field can be set to read-only by setting Editable = false when creating the definition or when configuring the field in BO. If the field is in the template it won’t be editable by the user. Does not apply to fields inside of multi-fields.

Thanks for fast reply.

Im trying to have a field in a block where the field is hidden for editors but defined with data at creation of the block. So everytime a create my customblock it already has a hidden field with same stored data for every of my customblock.

Is this possible?

You could listen for the DraftBlockCreated event, check if the it’s the right type of block (by field template), set your value and then update the block.

Remember to have an exit condition (value already exists) in the event handler, so you don’t get stuck in a loop.

https://docs.litium.com/documentation/architecture/events-handling/dot-net-events

But if it’s always the same value, does it need to be set on the block? Sounds like the builder - for example - could set the value in that case.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.