1

I have an App called "Features"

In Features, I have these fields:

  1. Heading
  2. Text
  3. Image

The app has two separate razor templates. One of the templates displays an image, and the other one does not.

How can I hide the "Image" field from Template B, but still display it in Template A? Is this possible with Formulas? If so, how?

1 Answers1

2

Yes, this can be done with formulas ;) Best check out the current Content Templates, the basic-content (text/image) templates have exactly this implemented.

If you open it from a template which doesn't show images, the images-field is hidden (but the editor can reactivate it). So this is quite sophisticated, you can also do simpler implementations.

Basically the steps are:

  1. Create an ephemeral field which just serves as a temporary variable to determine if it should be shown by default or not - we usually call it something like VarShowImage - probably default to true (so if it's not set, it's true when the form loads) https://docs.2sxc.org/basics/data/fields/ephemeral.html
  2. In the toolbar where it should be hidden, prefill this like VarShowImage=false
  3. On the field which should be hidden, create a formula to control visible based on this field
iJungleBoy
  • 5,325
  • 1
  • 9
  • 21