1

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?

1 Answer 1

2

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.

4
  • Thanks, If I use Classic Experience, rather than using Content editor/Script editor web part, can I edit in SPD or is this not a good idea? Commented Dec 11, 2020 at 11:13
  • Best idea is to use modern tools because classic will go away sooner or later. If you are going with classic experience approach then I think you can achieve what you want using Content editor/Script editor web part (custom html/css/js and REST APIs). Commented Dec 11, 2020 at 13:27
  • With a modern page, would you know if its possible (or sensible) to add libaries / content to a page using UI and then only develop an SPFX webpart for a specific purpose such as validation and add that to the page also. I'm trying to reduce the amount of spfx dev. work needed. Commented Dec 11, 2020 at 15:24
  • If you are going to use OOTB list/libraries web parts and need customizations for validations only then go with classic pages and content editor web part. Commented Dec 11, 2020 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.