Question

I haven’t developed in SharePoint for a while and trying to gain some knowledge on how to create a interactive SharePoint Online page - either classic or modern.

The requirement is to display/edit a simple page with some items from lists/libraries. So I thought of a web part page. Once solution is created, I want to template solution and re-create another site(s).

The solution needs to limit certain lists / libraries to 1-3 items. i.e. a user can only create one item in a certain list otherwise a warning is displayed.

I would have expected JavaScript to allow this validation, but it seems MS are not allowing JS any longer and instead are advocating SPFx? (I have tried SPD and I cannot seem to add script editor).

Is there a simple way to achieve my requirement without building a full SPFx solution I was thinking if the bulk of the work can be done in the UI and maybe add a widget validation script?

Was it helpful?

Solution

Modern Experience:

If you are using Modern experience and has development experience then I would suggest you to build SharePoint framework web part.

As you want to use the solution across multiple sites, SPFx will help you to use web parts on multiple sites if you deploy web parts at tenant app catalog level. SPFx solution will also you to Provision SharePoint assets like lists/libraries, content types, columns, etc.

If you don't want to use the SPFx then you can try using any one of below modern script editor web parts and adding custom JavaScript code:

  1. react-script-editor
  2. Modern CEWP by SPJS

Classic experience:

If you are using classic experience in Team site then you can enable custom scripts in your tenant and use Content editor/Script editor web part.

Content editor/Script editor web part is not available in Communication sites.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top