New answers tagged

1

var value = formCtx.fieldValue; value = Math.floor(value/10) * 10; If the original value is between 0 and 100, dividing by 10 will give you a value between 0 and 10, with a decimal place. Math.floor will round down to the nearest integer, getting rid of the decimal. Then multiplying by 10 again will get you back to an even multiple of 10. So for ...


0

You will have to add a column to your list view, then choose Type as Date and Time and put the default value as Today's Date. You create a new column under views in Library settings.


0

Create One Calculated type column and set data return formula type to Number and apply this formula: ="<img src='/_layouts/images/blank.gif' onload=""{"&" var day=new Date();"&" this.parentNode.innerHTML= day ;"&"}"">" You will current date and time.


0

You create the column as you'd like, and set the default value to Todays Date.


0

2 possibilities: Custom Editfield via jsLink Add a editform render with a custom UI that only allows your values. You could even implement a validation but thats a bit more tricky. List Validation Settings Add a formula that checks for your field to be in the desired state. This works OOTB.


0

Your item-HTML needs to be formed like the default html. If you dont want to rebuild everything just call RenderItemTemplate(ctx) and modify the return html. Example (function () { function RenderListItemTemplate(ctx) { var $html = $(RenderItemTemplate(ctx)); $html.children("td").css('font-weight', 'bold', ...


1

It is really unhelpful that there is so much confusion in the MS developer community about what is allowed in custom actions in SharePoint 2013. Trying to be helpful, Hermant Mane offered an answer and several comments above but gave examples for SharePoint 2010. The article linked to on spdeveloper.co.in is under the heading "Pre-SharePoint 2013" and was ...


0

I notice that you didn't include IE8 in your list of browsers that you tested against. SharePoint 2010 masterpages by default force Internet Explorer 9 through 11 to emulate IE8. Even without the masterpage explicitly asking for IE8 mode, users (or IT departments) can configure Internet Explorer to run in "compatibility mode," when viewing certain URLs, ...


0

What you call the "add/remove list field" is actually a "multi lookup field". You can retrieve values from it as described in http://sharepoint.stackexchange.com/a/93486/35604 or http://stackoverflow.com/a/22698793/3439544.


0

Is there any chance you could try the "Query string Url" filter connected to your list view web part (with appropriate column)? If you need to, you can also pass the date explicitly in the querystring through JS or jQuery.


0

The original error indeed occurs when digest has been expired or it could not be retrieved ( e.g. SharePoint:FormDigest control is not available on the page) on the page. There are some another issues with the provided example. For updating list item the following parameters need to be specified: method: "POST" headers: "Accept": ...


0

I got a solution for my question. When Edit Permission button hit following URL will be passed to SharePoint http://xyz:1010/sites/raja/_layouts/editprms.aspx?obj=editprms.aspx?obj=http%3a%2f%2fxyz%3a1010%2fsites%2fraja%2cWEB&amp;sel=1&amp;IsDlg=1 In SharePoint there is one hidden list is called SiteUserInfoList which contain the details about ...


0

Use this css to enable the scrollbars: iframe { overflow: scroll; }


-1

scrolling property is not supported in HTML5. Try removing that all together.


0

I was able to use the GetUserProfileByName of UserProfileService.asmx to get information for users even if they are not in the site collection. https://msdn.microsoft.com/en-us/library/aa981482(v=office.12).aspx


3

Few things are missing Loading su.getSharedWithUsers() Calling ctx.executeQueryAsync() Modified code var ctx = new SP.ClientContext(_spPageContextInfo.webServerRelativeUrl); var list = ctx.get_web().get_lists().getById(_spPageContextInfo.pageListId); var su = SP.ObjectSharingInformation.getObjectSharingInformation(ctx, list); var sharedWithUsers = ...


0

You can create a calculated column with the following formula: =CONCATENATE("<img src='http://www.google.com/s2/favicons?domain="&[you-url-column]&"'/>")


0

For changing visual style, combining CSS and the :nth-child selector is likely to be the way to go. This isn't in JSGrid, but it also isn't javascript and won't break any scripts.


2

Using JSOM you can find out whether the user is a domain user or not. But there is no JSOM method available to expand a domain group and find the users. If you want to stick with JavaScript then you should create a web service, that can give you the information. Deploy the web service under SharePoint context and use AJAX for getting the data.


0

After long investigation we found that antivirus of the enterprise PC was creating the issue.We added exception for sharepoint designer exe on the antivirus client which resolves the issue.


0

Will need to add sp.runtime.js to this list as well..just below the init.js


0

listItem.[Contractdaysleft] is this correct? i think it should be listItem[Contractdaysleft] without dot.


0

what do you mean by a "list"? a sharepoint list? you can use JSOM or rest API to store information into sharepoint lists. more information is here


0

Do you think its the typo in the code...'iid' and 'idd'? If that's not it, check the dev tools to see if you see any errors in the console. Then write the values of 'iid' and 'row' to console using console.log(iid) and console.log(row). Check if any of those values are undefined. Do the same inside the if conditions too. Let me know at what point you are ...


0

I would like to submit my solution, as it cuts out one of the issues present in all of the other solutions: determining which files were just uploaded. It turns out, that we can hook into a different spot by monkey patching the CheckFilesCheckedOut function within DragDrop.js. ExecuteOrDelayUntilScriptLoaded( ReplaceDragDropCheckFilesCheckedOut ...


2

Find folder name from ServerUrl of your document. It should look like "/{LibraName}/{FolderName}/{fileName.extention}" So the folder is always before the document. Coding Changes cqy.set_viewXml("<View Scope='RecursiveAll'> <ViewFields> <FieldRef Name='ID'/> <FieldRef ...


0

Thanks a lot DANIEL, but it gave me a small error that SP.UI.ModalDialog.showModalDialg is not defined, i made the below change and it works: <script type="text/javascript"> function ShowInModal() { var options = { width: 950, height: 350, url : "/sites/../CustomNewForm.aspx" }; options.dialogReturnValueCallback = ...


0

The error appears to relate to the problem that I posted here Unable to get property 'PageManager' of undefined or null reference SP2013 I have now fixed that error, so I'm assuming that this problem will be fixed as well. It makes sense to move the code out of the Calculated column into the JS, so this is what I am going with, and the solution ...


0

I'm not too sure about the question. If you mean something like auto-filling the label with the current user, you can request the current user object which has information like email, display name, log in name, etc. Check out SP.ClientContext to do this using client-side scripting. Check out ...


0

Try out with below method. I had achieved with this code long back. function AddFolderToSPList(folderName) { var oWebsite; var oList, oListItem; var itemCreateInfo; var clientContext = SP.ClientContext.get_current(); var oWebsite = clientContext.get_web(); oList = oWebsite.get_lists().getByTitle('ListName'); ...


3

Very good post by SPArhaeologist, mark it as the correct answer so everyone reads it first. Some additions At one point I disagree with SPArhaeologist; you should not program to avoid this JavaScript scope is confusing when you are first faced with it; but just like any other technology, once you understand and master it, it can become a very powerfull ...


0

you can create your own file control in HTML and hook it up with the below script. I use an asynchronous loop to iterate through the files (works in IE9). //Enable Multiple Upload Script $('.attachmentButton').change(function(event){ //alert("change"); //startUpload(self, function (){ reloadPage(); }, event); ...


1

You need set EnableFolderCreation to True before create folder in list. Add this code. var clientContext = SP.ClientContext.get_current(); var oWebsite = clientContext.get_web(); var list = oWebsite.get_lists().getByTitle("Scripts Test"); //Enable Folder creation for the list list.EnableFolderCreation = true; list.Update(); context.ExecuteQuery(); ...


0

Pretty much, although you would want to left outer join your tables. Have a look at this MSDN article for reference.


2

The whole problem with this is that it the rules for its resolution are often not well understood by inexperienced developers and even more experienced ones still sometime find them strange. While in most OO languages, "this" is the current object instances, Javascript defines this in relation to the invocation context of the function. This means that the ...


0

always must use <SharePoint:ScriptLink language="javascript" name="sp.js" OnDemand="true" runat="server" Localizable="false" /> I lost 2 days fighting with this , i dont know why nut it doesnt works using script src


0

_layouts is a virtual directory that maps to a folder in the file system of a SharePoint server. This folder is used to store files and templates (including JavaScript files) that are used across the SharePoint farm. I cover how to deploy and reference JavaScript files in my JavaScript and jQuery for SharePoint Developers conference session which I've ...


0

I think I found my mistake... It's seems that sp.runtime.js has to be loaded manually. <script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script> <script type="text/javascript" src="/_layouts/15/sp.taxonomy.js"></script> <script type="text/javascript"> $(document).ready(function(){ ...


0

var options = { url: dialogUrl, allowMaximize: dialogAllowMaximize, showClose: dialogShowClose, width: dialogWidth, height: dialogHeight, title: dialogTitle, dialogReturnValueCallback: function(dialogResult) { SP.UI.ModalDialog.RefreshPage(dialogResult) //This will refresh the ...


-2

function CreateView() { var hostweburl = "INSERT HOST URL HERE"; var appweburl = "INSERT APP URL HERE"; //creating the client context var clientContext = new SP.ClientContext(appweburl); var appContextSite = new SP.AppContextSite(clientContext, hostweburl); //get the current web var web = appContextSite.get_web(); //get all ...


1

What you are looking for are called "Remote Event Receivers" and they are only available in Provider Hosted Add-Ins (https://msdn.microsoft.com/en-us/library/office/jj220043.aspx.) Given that SP Hosted Add-Ins can only use javascript that executes in the browser, there is no way to react to an OOTB event such as ItemUpdated. What you could do is implement ...


0

The best way to achieve this is "Filter WebParts" but you need to some JavaScript custom coding as well. First Get all the values from your input Drop-downs and modify the url by applying filtered link which are specially works for SharePoint filter webparts. to filter web part links looks like : ...


3

One way to deal with the issue is by utilizing the content by search and filters/refiners. You can also create a result source which retrieves the indexed results from the specified list. If your columns in a list were created as a site column, it will automatically have crawled properties. You can use 'RefinableString' property and map your indexed crawled ...


0

To upload a file to SharePoint from C# code, the best is to use the client-side C# API of SharePoint. This only requires to add two DLLs as references to your Web app project (Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll). Examples of usage to upload files: http://stackoverflow.com/a/9849835/3439544 ...


0

//try this to create a new file with your own content < div > < button onclick = " createfile ()" > Click here to createfile < /button> < div id = " resultpanel " > < /div> "> function createfile (resultpanel) { var clientContext; var oWebsite; var oList; var fileCreateInfo; var fileContent; clientContext = new SP.ClientContext.get_current(); ...


3

Insert Script editor webpart and on click on the button add and call this function <script type="text/javascript"> function hideEdit() { var edit = document.getElementById("Ribbon.ListForm.Display.Manage.EditItem-Large"); edit.style.display = "none"; } _spBodyOnLoadFunctionNames.push("hideEdit"); </script> ...


3

<script type="text/javascript"> function hideEdit() { var edit = document.getElementById("Ribbon.ListForm.Display.Manage.EditItem- Large"); edit.style.display = "none"; } _spBodyOnLoadFunctionNames.push("hideEdit"); </script> Another approach : You can have a look at here


0

I have struggled with this also, I am using Andrei's Chrome Cisar plugin and had to rework the defdault Cisar template code a bit so Cisar continues to Live update the Template code in the Cisar editor. For now this works for me in Development; would love guru feedback on pros and cons SP.SOD.registerSod("iCSR", 'https://myCDNdomain/iCSR.js'); ...


0

The site you referenced is using an overly complicated script for what you need. You should try using ExecuteOrDelayUntilScriptLoaded, _spBodyOnLoadFunctionNames.push, JQuery's defered. ExecuteOrDelayUntilScriptLoaded can be used when you want to wait for an external library or your custom JS to load first: ExecuteOrDelayUntilScriptLoaded(checkJQuery, ...


1

I believe you can use SP.ExceptionHandlingScope as a 'batch try/catch' which will not cause your entire operation to fail if just one call fails on the server after you send it off. Something like this (note that I have not personally used this function, but it is documented (https://msdn.microsoft.com/en-us/library/office/ff411960%28v=office.14%29.aspx)): ...



Top 50 recent answers are included