Services de consultation Microsoft 365 / SharePoint

How to control fragment visibility in specific forms

Goal: Display a Fragment only in NewForm.


  • Create a new fragment and, using the source code option, wrap your fragment into a DIV with an ID. Set the style to « display:none; ». So by default the fragment will not be displayed.

Note: Don’t worry if your fragment does not show in the WYSIWYG editor, this is the result of the display:none style. You just need to use the « Source Code » to view the HTML or you can remove the display:none style to edit your fragment with the WYSIWYG editor and put back your style when done.

Fragment with DIV

  • Now we will attach a style to the New form to unhide the fragment.
    1. In the style section, select « New » to apply the styles customizations to the new form
    2. Enter the DIV id with a # in front (CSS ID selector)
    3. Enter the display style and set it to block. Add the !Important attribute. Our CSS definition will get precedence over the DIV inline style.
    4. Click Add next to the selector configuration
    5. Click Add to insert the « New » form style configuration.
    6. Click Save

Fragment DIV Style

We could have not set an in-line style in the DIV (see first step) and configure style for each forms (New, Edit and Display). But the way it was done just need to create a style configuration for the new form.

Have Fun!

Laisser un commentaire

Votre adresse courriel ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire le pourriel. En savoir plus sur comment les données de vos commentaires sont utilisées.