Posts

Showing posts from April, 2020

Set SharePoint List forms fields enable or disable using jQuery

Image
How to set SharePoint List forms fields enable or disable using jQuery Go to a SharePoint List Form. Edit the form and add script editor web part to it. Insert the below code in the script editor web part. Code- <script src="../../SiteAssets/JS/jquery-3.1.1.min.js" type="text/javascript"></script> <script src="../../SiteAssets/JS/HideFields.js" type="text/javascript"></script> HideFields.js Code- $(document).ready(function(){ $("input[title='Title Required Field']").attr("disabled", "disabled");  $("select[title='request type Required Field']").attr("disabled", "disabled"); $("textarea[title='description']").attr("disabled", "disabled"); $("input[title='requested Go-Live Date Required Field']").attr("disabled", "disabled"); $("textarea[title...

Limiting SharePoint People Picker field to an specific group of people

Image
How to Limit SharePoint People Picker field to an specific group of people In many cases we need to choose people within a specific SharePoint group, in that scenario we go to the column settings as shown below and under choose from section we select a specific SharePoint group. The above screen shot is for a people picker type field and we can change its settings as shown above.

$(window).load() Vs $(document).ready() in jQuery

Difference between $(window).load() and $(document).ready() in jQuery What is a DOM? DOM : The Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents. $(window).load() - The code which gets included inside $( window ).on( "load", function() { ... }) runs only once the entire page is ready (not only DOM). $(window).load(function(){    // executes when complete page is fully loaded, including all frames, objects and images    alert("(window).load was called - window is loaded!"); }); $(document).ready() -  The ready() method is used to make a function available after the document is loaded. Whatever code you write inside the $( document ).ready() method will run once the page DOM is ready to execute JavaScript code. $(document).ready(function(){    // executes when HTML-Document is loaded and DOM is ready   ...

Check Whether user belongs to SharePoint Group using REST api

How to Check Whether user belongs to SharePoint Group using REST api Code -  $(document).ready(function(){     isOwnerGroupMember();  }); function isOwnerGroupMember() {     $.ajax({         url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups/getByName('Test Owners')/Users?$filter=Id eq " + _spPageContextInfo.userId,         method: "GET",         async: false,         headers: {             "Accept": "application/json; odata=verbose"         },         success: function(data) {             if (data.d.results.length == 0) {                 console.log("User not in group : Test Owners");                                   ...

Push Unique Values to an Array

How to Push Unique Values to an Array data.d.results is the given array and it will push only unique column values to an array. var UnArr = []; $.each(data.d.results, function(key, value) { if ($.inArray(value.Title, UnArr) === -1) { UnArr .push(value.Title); } }); The output UnArr [] Array will have only unique values now.

Display Loading Image While Page Loads using jQuery and CSS

How to Display Loading Image While Page Loads using jQuery and CSS HTML- Add the following HTML after the <body> opening tag. <div class="loader"></div> CSS -  Use the following CSS to display a loading image on loader div. .loader {     position: fixed;     left: 0px;     top: 0px;     width: 100%;     height: 100%;     z-index: 9999;     background: url(image URL) 50% 50% no-repeat rgb(249,249,249);     opacity: .8; } CODE -  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> <script type="text/javascript"> $(window).load(function() {     $(".loader").fadeOut("slow"); }); </script> Note:- You can do customization in the CSS and image type as per your requirement. Happy Coding :)

Hide list or Library using SharePoint Designer

Image
How to Hide list or Library using SharePoint Designer SharePoint Designer is a very useful tool when you need to do some customization, if you do not have development expertise to execute any PowerShell Script then you can easily do it using SharePoint Designer. 1.Open the site in SharePoint designer and click on Lists and Libraries from left panel. This will show all the list and libraries in current particular site. 2.Click on the list or library which you want to show or hide from the browser or view site content. In the settings section, click on the “Hide from Browser” under General. Save the changes and refresh site in browser, the list/library is now hidden from all users.