Questions tagged [javascript]

Javascript is a dynamic computer programming language, most commonly used as part of web browsers, whose implementations allow client-side scripts to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed.

Filter by
Sorted by
Tagged with
2
votes
0answers
84 views

Display Modifications Each Time an Item is Updated

Not sure if this can be accomplished, but I want to try. Objective: When an item is modified SharePoint keeps track of the modification date, time, and person who modified the item. You can see ...
2
votes
1answer
145 views

display all events of single date in single row of html table in <td></td> using javascript/JSOM

am trying to fetch all single day event from SharePoint calendar list and want to display all these single date's events into the single row of html table inside based on appropriate condition i tried ...
2
votes
1answer
1k views

Clear Multiselect Lookup

I am trying to add a button for my users to clear a multiselect lookup value using JQuery or Javascript. I have found some information about setting a default value on a single select lookup, but ...
2
votes
1answer
2k views

how to open list form in new window instead of dialog? SharePoint 2013

I have the following line of code which shows me the dialog of my list: <a href="javascript:SP.UI.ModalDialog.ShowPopupDialog('http://mysite/Lists/mylist/NewForm.aspx');">Add New Item</a> ...
2
votes
1answer
248 views

Populate people picker during PreSaveAction

I'm in a SharePoint 2013 on-prem farm. I have a people picker field called Managers that I want to populate based on users in another people picker field. Once the user clicks Save on the New Form, it ...
2
votes
1answer
624 views

JavaScript Code in the SharePoint 2013 calculated column

I added the code below to a SharePoint calculated column in order to get today's date, and it works well, however, I will need to add another calculated column to get the date difference between "...
2
votes
0answers
76 views

Another “load required sharepoint files” issue

I know there are many posts on the subject of dynamically loading SP files. I've tried so many of them, but none of them seem to work. As I was trying to solve an issue I realized I had to back up and ...
2
votes
1answer
2k views

How do you get the default label of a term through JavaScript?

Most of this code comes from an answer to a previous question. I'm trying to take it one step further now and get the actual default label string. var context = SP.ClientContext.get_current(); ...
2
votes
1answer
478 views

SharePoint custom JavaScript and jQuery blocked by MDS Minimal Download Strategy

Here's my setup. Onprem SharePoint 2016. I have a master page which is basically a copy of seattle.master and I want to add jQuery and a custom Javascript to manipulate the DOM. The minimal download ...
2
votes
2answers
419 views

Add default value to the site column inside content type using javascript Sharepoint 2013

I am creating some site columns using javascript. And also I am creating content types. I am attaching these site columns to the content type with the <FiedRef> tag. But I want different default ...
2
votes
1answer
6k views

Using Javascript to change the view on a calendar web part

I found a very simple snippet that I can add to a CEWP that changes the view in a calendar web part from Day, Week and Month. This is for an external facing SharePoint site and the ribbon will not be ...
2
votes
1answer
1k views

Using csom search api, how can I search lists based on content types?

I have multiple subsites and each subsite has a list called "Articles". Each has two content types. "News Articles" and "Success Stories". I would like to search based on the content types above using ...
2
votes
3answers
934 views

Can a web part prevent master page jQuery from executing properly?

I'm including jQuery and a custom .js file into the master page of my SharePoint 2010 site. In the $(document).ready() function, I'm setting a live event handler on an element in the header of the ...
2
votes
3answers
1k views

Expected ; on javascript

I got the following code in my elements.xml, but I cant find the error. My ribbon is broken, the error says, expected;. But I see no error, yet, maybe fresh eyes can see it. See the EnabledScript ...
2
votes
2answers
4k views

Get web part Id with javascript client OM

Do you know how to get the current web part Id with the javascript client OM API ? Or an idea for a work-around ? Thanks
2
votes
2answers
10k views

How do I get the number of items in a list?

I have a list with a lot of items in it I need to know the list item count the following is my code: var sListId = SP.ListOperation.Selection.getSelectedList(); var oWeb = item_clientContext.get_web()...
2
votes
2answers
9k views

What arguments can I pass to NewForm.aspx using SP.UI.ModalDialog.showModalDialog(options)?

I'd like to create a task with a pre-filled title, as well as set some other properties. I found this documentation that says I can pass arguments when i call SP.UI.ModalDialog.showModalDialog(...
2
votes
0answers
2k views

How to get the return value of an on demand executed function?

I have a script file MyScript.js in the folder TEMPLATES\LAYOUTS\MyProject\Scripts which looks like this: var MyCompany = window.MyComapny || {}; MyComany.MyProject = MyComany.MyProject || {}; ...
2
votes
0answers
432 views

Correct usage of getListItemChangesSinceToken() in JavaScript

I'm working on a Sharepoint hosted App, that accesses List Data from the Hostweb as I outlined here: EventListener for List changes in Sharepoint Hosted app I want to use the ...
2
votes
1answer
1k views

SharePoint 2013 lookups with more than 20 items as select or input?

So I was reading about doing some JavaScript to manipulate the default forms for our lists and came across this: http://geekswithblogs.net/SoYouKnow/archive/2011/04/06/setting-sharepoint-drop-down-...
2
votes
3answers
838 views

Inject javascript into a page from a feature

I want to add a verb (link in the top left menu of a web part) to all the web parts in Sharepoint 2010. Is there a way to inject javascript into a all the pages from a custom feature?
2
votes
2answers
2k views

Create a modal dialog popup on load which would appear only once a day

<script language="javascript" type="text/javascript"> SP.SOD.executeFunc('sp.js', 'SP.ClientContext', MyPopUp); function createCookie(name,value,days) { var expires; if (days) { ...
1
vote
1answer
673 views

Javascript not loading for users with Read permission

I got a Javascript on a Sharepoint 2010 site which is not loading for users with Read permissions. The Javascript is embedded in the site and users with Read permissions have access to it, but the ...
1
vote
2answers
2k views

GetUserEffectivePermissions returning 0 (“EmptyMask”)

I'm trying to retrieve the current user's permissions for a list but I keep getting an emptyMask result, even when my current user account is a Site Collection Admin. function ...
1
vote
2answers
232 views

JSOM Error: unable to get property 'apply'

I get an error after attempting to update an item SharePoint 2013. This one is a bit of a challenge since it's referencing a different file. var siteUrl = _spPageContextInfo.webAbsoluteUrl var ...
1
vote
2answers
764 views

JSOM Error in SharePoint Client Code When Retrieving User Object

Trying to figure out why I am getting this error with my code, am I missing a script reference, or is perhaps something wrong with the Context data grab section? Error: The property or field 'Email' ...
1
vote
2answers
732 views

Sharepoint Multilingual App

I'm making an app with a custom list in multiple languages. Is there an easy way so that I only have to create the site columns, content type and list once? So I don't have to create them for each ...
1
vote
1answer
2k views

Load list item to dispaly get_fieldValues?

I'm using SharePoint online and have a SharePoint-hosted app. I have a page with a question form that send data in to Sharepoint using listItem.set_item('GEN_1_blabla', $('#GEN_1').val()); Now in ...
1
vote
1answer
780 views

Files move from one library to another library using jsom

Below code is working fine, but inside for-loop if I put alert,then moving multiple file but if I remove, only one file moving. I do not want any alert/pop up. Please suggest. ...
1
vote
1answer
3k views

How to access the data from Manage User Profiles?

We are have sync the SP with AD using Active Directory Import for SharePoint 2013. All the users have been picked up into the Manage User Profiles and new user properties have been added to the ...
1
vote
1answer
533 views

JSLink for showing the Sum of my list columns will break if one item contain empty value.. it will return “NaN”

I am working on a sharepoint server 2016. and i want to show the sum of my list fields.. so i follow this appraoch:- https://social.technet.microsoft.com/wiki/contents/articles/30317.sharepoint-2013-...
1
vote
0answers
949 views

Get Taxonomy Terms, GUIDs, Synonyms (Other Labels) into Array within a SharePoint Page (not App)

I am using the code below to get terms (Later I will push these into an array). This is based on this article: Working with Taxonomy and JavaScript in SharePoint 2013 It is pushing the term names, ...
1
vote
2answers
5k views

Autopopulate form fields based on selection in people picker column using JavaScript

I have a custom list where user fills out profiles of others. There is a People picker column for "Name of employee" and when the user selects the person(people picker) in the form, other details ...
1
vote
1answer
18 views

Jscript Display Template on SharePoint List

I have a very simple JScript that replaces a list view value with an image based upon criteria. Seems to work ok, but the return view is a small with box with a line through it. My images are 20px x ...
1
vote
2answers
3k views

Insert JavaScript into Web-Part

I have inserted into my Home.aspx a list with Web-Parts like this: Now I want to know how can I apply JavaScript to this list? Note: I want to display an image depending of selected of one field
1
vote
2answers
3k views

Redirect Save on NewForm.aspx Without Custom Form

I need the Save button on a list's NewForm.aspx page to redirect to a "Thank You" page. I need to do this without creating a custom form or a new page (though I'm willing and able to create one for ...
1
vote
1answer
542 views

print only the infopath webpart on a sharepoint 2013 page

I have a sharepoint 2013 page with a infopath form. I would like this page to contain a button that only prints the specific form ignoring the rest of the page. I have found the below script (source: ...
1
vote
1answer
7k views

How to fetch user profile image from Azure Active Directory from SharePoint Online page?

I have to display all SharePoint Online user's profile information including profile picture on a page in SharePoint Online. Here some of user has profile picture set in Office 365, while some users ...
1
vote
2answers
5k views

spBodyOnLoadFunctionNames not working on Master Page

we are trying to execute some script after the master page loads. <script language="javascript"> _spBodyOnLoadFunctionNames.push("FunctionName"); function FunctionName() ...
1
vote
3answers
20k views

Get list ID and selected item ID

I use SharePoint Online and working in Visual Studio with SharePoint hosted app I need to get list id and the id of the SELECTED item in the list And i use a ribbon button to show a dialog and want ...
1
vote
2answers
620 views

How to hide SharePoint list columns from users based on permission

I need to hide "Approver" add "Title" fields in my SharePoint list. I used the following JS. <script type="text/javascript" src=class="vglnk" href="https://...SiteAssets/jquery- 1.10.1.min.js"<...
1
vote
2answers
6k views

SP 2010 CSOM Javascript: serverRelativeUrl fails

I have a custom html and javascript file housed within a document library of a subsite: http://teamsite/project/testing%20site/shared%20documents/test.html and http://teamsite/project/testing%20site/...
1
vote
2answers
266 views

Find list element when page is loaded

I'm trying to get an element once page has been loaded. However when I put the code in window.onload = function () { my code }; it's not working, without window.onloadit get's the element. here's my ...
1
vote
1answer
770 views

Best way to encode list names in sharepoint 2013 rest url's?

In SharePoint 2013 rest url's, some of them includes a list name which is passed by a user (in the web part settings) which I then use in a web part. I then stick the list name in a rest url, but now ...
1
vote
2answers
407 views

EventListener for List changes in Sharepoint Hosted app

I'm developing a sharepoint hosted Add-in, which should react to a change of a list field of a list in the hostweb. I need some kind of EventListener for a list field. For example: List field Gets ...
1
vote
2answers
750 views

Open Modal Dialog on Title click in list?

I have a Sharepoint-hosted app. When you click on "No Title" in a list you get a new window where the items is being showed. What I want is, when user click on "No Title" in the list it should pop up ...
1
vote
1answer
2k views

SharePoint 2010 Modal Dialog on Page Load

I have created an application page that mimics an input form. This form will eventually go into an SP List with other forms. What I'm after is when a user clicks the link to the form from the SP ...
1
vote
1answer
3k views

How get item ID in JSLink on DisplayForm

I'm customizing the DisplayForm of a list, and I want put a button on footer to EditForm, but in the ctx has no edit form url and no CurrentItem.ID. How can I do this?
1
vote
3answers
4k views

How to Make Webpart Title to Display Day of the Week?

I have list View webpart in my sharepoint 2010 team site home page. Generally Web Part title can be easily modified by editing the webpart and providing Title value. I am looking for a solution to ...
1
vote
1answer
95 views

Javascript to create parameter based links

I am in the process of redesigning my site set up to make it completely automated. Currently, we have a little script editor that shows some links like such: The code for the script editor looks like ...