Posts

Showing posts from June, 2013

Disable people picker column in New/Edit Form

Image
The following JQuery script can be used to achieve this. Please note ApproverName is nothing but people picker field name. <script type="text/javascript"> $(document).ready(function() { $('nobr:contains(" ApproverName ")').closest("td").next("td").attr("disabled", "disabled"); $("div[id$='_UserField_upLevelDiv']").attr("contentEditable",false); $("span[id$='_UserField']").find("img").hide(); } ); function PreSaveAction() { $('nobr:contains(" ApproverName ")').closest("td").next("td").removeAttr("disabled"); $("div[id$='_UserField_upLevelDiv']").attr("contentEditable",true); $("span[id$='_UserField']").find("img").show(); return true; } </script> Here the PreSaveAction is very important. If you did not include this function the v...

Maximize modal dialog window automatically

In my previous post I have shown how to open a page in modal dialog. In this post I am going to show a script which will be used to open a modal dialog in maximize mode. In this case we do not required to mention width and height in modal dialog options. <script type="text/javascript">     function maximizeWindow() {         var currentDialog = SP.UI.ModalDialog.get_childDialog();         if (currentDialog != null) {             if (!currentDialog.$S_0) {                 currentDialog.$z();             }         }     }     ExecuteOrDelayUntilScriptLoaded(maximizeWindow, 'sp.ui.dialog.js'); </script>