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
6
votes
1answer
402 views

How to load the list items in a GridView when scrolled C#

How to develop a VisualWebPart that loads list items on demand when scrolling the GridView, because I have a list with more than 10000 items and performance is key for this application. Description: ...
6
votes
1answer
9k views

Using SharePoint 2013 Cross-Domain Library in a simple web page: is it possible?

I have a web page hosted on a server, say at http://SVR1/path/index.html, and I would like to access some list items in a on-premises SharePoint site hosted on another server, say at http://SVR2/sites/...
6
votes
1answer
155 views

SharePoint 2010 list Item Query

We have a big list in SharePoint 2010. I'm gonna query SharePoint 2010 list item in the web part based on country. I used CAML and JS. I have got errors in different browser" Internet explorer says ...
6
votes
0answers
77 views

SharePoint sometimes adds script in page without any reason

I have this weird problem on one of our customer's SharePoint (2010): sometimes, on different pages, the page came out broken, with a bunch of HTML and scripts inside the normal page. I started ...
6
votes
0answers
397 views

SP's JavaScript function to create pagination

SharePoint 2013 here. I need to create a pagination of results I get from an external web service. I want to use the look and feel of SharePoints pagination: Ideally I could call SharePoint's ...
6
votes
0answers
1k views

'Permission denied' javascript error on modal window opening in IE8

While opening any modal window (NewForm, EditForm, custom or OOTB) on a SharePoint list in Internet Explorer I get few SCRIPT70: Permission denied errors. This causes problem with saving the ...
6
votes
1answer
2k views

SPServices Autocomplete and dynamic CAML query

I have two Text filter web parts (Project and Customer Name) with Apply Filters button for one list. There is a SPServices.SPAutocomplete on each and it works great. Now, I want to show the values in ...
6
votes
1answer
4k views

Getting Version History and What Field has Changed

I am using the GetVersionCollection to get the history information from my list. This seems to be working fine; however, what I need to do is get the version history of the individual item which has ...
5
votes
5answers
854 views

How can I include jQuery and JavaScript code without straying from the site template?

I've added my JavaScript code by including the script links in the PlaceHolderAdditionalPageHead <asp:Content> tag. Including this has caused a yellow warning stating The current page has ...
5
votes
2answers
7k views

How to refresh page after closing dialog form SharePoint 2013?

I have created a dialog with the following code: function Dialog() { var options = { url: 'http://mysite/mypage.aspx', title: 'My Title', allowMaximize: false, showClose: true, ...
5
votes
3answers
20k views

How to update multiple items in sharepoint list online using javascript

I want to update 4 items in the same time in my sharepoint custom list using Javascript. Im using a camlquery to get the item witch i want to update. Can anybody please help me and write a function to ...
5
votes
4answers
14k views

Is there a way to get current item Id in Edit form

I open a list item for editing and want to execute some JavaScript for this but I can't retrieve the item Id in the Edit form. I use following code: var context = SP.ClientContext.get_current(); var ...
5
votes
4answers
12k views

Multiple Values in CAML query from Array? SharePoint 2010 using jQuery/SPServices

So if I use SPServices to GetListItems with CAMLQuery, is it possible to insert multiple values inside Value Type='Number'> here I would like to evaluate things throught a flow in my page, add to an ...
5
votes
4answers
17k views

Caml Query to return items created by logged in user

Using Javascript CSOM and want to return items created by logged in user, but the code below returns all items. Could someone advise? var camlQuery = new SP.CamlQuery(); var specifier = "<Eq>&...
5
votes
7answers
42k views

Get a SharePoint ListItem ID from a List where the 'Title' field is a specific value in JavaScript

I am trying to extract the ListItem ID of a List which I am currently NOT in based on a field value in that List. I cant find anything that explains how to do this. So, to explain. I have a Custom ...
5
votes
7answers
18k views

Set default value in people picker javascript/jquery

I want to set current logged in user to people picker by javascript. I can retrieve the value of user(lets say in var user).But how to set it to people control. Any help is much appreciated.
5
votes
4answers
10k views

Get current web url in a SPRibbon Custom Action Command

I've a SPRibbon custom action with the purpose of open an custom app page in a modal dialog, but I'm getting troubles for getting the current web URL, as well, set a reference for a .js with the right ...
5
votes
3answers
2k views

Sharepoint 2013 - List of Site Collection Administrator (JavaScript)

SharePoint 2013 On-Premises. I have a need to display Site Collection Administrators somewhere on the main page. To test this out, I have written a JavaScript for fetching user data of a website, ...
5
votes
3answers
4k views

Remove item from ECB in sharepoint 2013

I am currently trying to write javascript within a script editor to hide the 'View Properties' and 'Edit Properties' items in the ECB. I have found many solutions that edit the core.js file. However, ...
5
votes
2answers
411 views

Create modern team site in SPFx

I found some articles which are explaining creating modern sites with CSOM. But I am not able to find in JavaScript to use in SPFx. Creating modern sites is supported with SPFx? Any PnP extension ...
5
votes
2answers
1k views

SP 2010 JavaScript events

I want to hook into certain events on a SharePoint 2010 site, specifically the modal dialog open and close events. Does SharePoint 2010 trigger any events for these kinds of actions? If so, how do I ...
5
votes
4answers
16k views

Load JavaScript from external file in a web part

In order to hide the title of the page, I have placed JavaScript in a Script Editor presently. I want to add this functionality to few other pages. Is it possible to save this JavaScript in an ...
5
votes
7answers
33k views

Get current logged in user and display it on the Site as “Hello (Username)”

I am using SharePoint 2013 Online and I'm looking for some JavaScript and html to display the current logged in user on the site like for example: Hello (Username) If anyone could help or just ...
5
votes
2answers
5k views

Get multiple list items by respective IDs - Javascript object model / REST API

I am developing a custom ribbon action as Sharepoint hosted app, where the user can select any number of list items and click on the action. On click of the ribbon action, the app redirects to the app ...
5
votes
5answers
15k views

SP.ClientContext is not a Constructor

I keep receiving the error message "SP.ClientContext is not a Constructor" every time I try to use it in my JS code. After doing a bit of research online, I found SP.SOD.execute function(). However, I ...
5
votes
4answers
20k views

Get SharePoint user id from login name

I need to retrieve current user id from login name. How can that be done? I have used the following code: var userid=Function??("domain\name");
5
votes
2answers
2k views

jQuery CDN reference in SP Online MasterPage changed magically

My custom MasterPage deployed to SharePoint Online contains two links to JavaScript libraries on CDN's. Like this: <script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js">&...
5
votes
4answers
16k views

How to get ClientPeoplePicker value using javascript

can anyone please tell me, How to get ClientPeoplePicker value using javascript.?
5
votes
1answer
8k views

Javascript : How to handle version conflict errors when using javascript COM?

so I use quite a bit of the javascript client object model for CRUD operations to lists from custom pages (inputs) and I have found that I get version conflict errors on saves from time to time....its ...
5
votes
3answers
24k views

How to access list in SharePoint Hosted App?

I want to create an Sharepoint hosted app but how to access list in these App ??
5
votes
3answers
6k views

Set SP.UI.Status or SP.UI.Notify at PostBack

I use in my web part a Session[""] and would like to notify the user when the session is expired. I check at the PostBack event if the session is already okay, if not, I will execute a JS function ...
5
votes
1answer
812 views

How do I get the ID of the current Discussion Item using Javascript?

How can I dynamically get the ID of the current discussion thread in javascript? Currently, I have the following code: function submitReply() { var ctx = new SP.ClientContext.get_current(); ...
5
votes
2answers
10k views

SharePoint 2013 get user groups by CSOM

I wrote some code to get the current user groups by CSOM. function getCurrentUser() { this.clientContext = new SP.ClientContext.get_current(); this.oWeb = clientContext.get_web(); ...
5
votes
3answers
5k views

Run JavaScript after “group by” in list has been clicked on and list data loaded

I have created a JavaScript function to take a url from a list item and turn it into an image. This function works great on a list that doesn't have group by setup. With this script the images will ...
5
votes
3answers
44k views

Why does jquery's document.ready not fire?

In my master page, I have attached jQuery along with my own custom.js. I use the javascript in that file to run fixes on my pages such as style adjustments. Now, when I run simple functions on my ...
5
votes
4answers
10k views

JS files returning Cached (Old) Versions Despite Update

We are currently in the wild throes of a migration from SP 2007 to SP 2010. I'm attempting to move some custom JavaScript Validation from the current production site to our staging site. My ...
5
votes
8answers
34k views

How can we get Cascading Lookup Columns in sharepoint 2010?

How to get the cascaded Lookup columns in sharepoint 2010,Iam having requirement like i have two lists(Category List and Sub category list)..For each item in category list i have 5 different items ...
5
votes
3answers
490 views

Responsive content to list view width in SharePoint 2013

When I change the width of a SharePoint list to a certain amount of Pixels, I have the problem that some content of the list gets cut off on the right side - see the following Screenshot: Is there ...
5
votes
2answers
3k views

window.scrollTo is not working in SharePoint Office 365

I am trying to scroll to top of the page using Javascript I tried the below code window.scrollTo(0,0) This works in all the other tabs (in chrome browser), except the tab which had office 365 page ...
5
votes
1answer
426 views

Column Validation Settings for a mandatory choice

I have a SharePoint 2013 list with 3 dropdowns of which 1 must be selected. It doesn't matter which is selected as long as one of them has data. I tried to do the Validation Settings: =IF(AND(...
5
votes
1answer
2k views

Unable to Save List item after using PreSaveAction() function in NewForm.aspx page

as per my requirements Check current user is present in manager group If not present Check status columns If status column consist value other than Requested then stop user to Save item so for ...
5
votes
1answer
10k views

Onchange People Picker

I have a problem changing a people picker in a custom form. Need when writing or changing the value in the people picker I know, I'm using javascript using jquery. Already tried using this code: $...
5
votes
2answers
7k views

Get Navigation Term for Current Page in CSOM (JavaScript)

I am trying to get the Local Properties for the Navigation Term that is currently being viewed. For example... If I navigate to http://sp2013/about/team I need to get the Local Custom Properties for ...
5
votes
3answers
5k views

Check an Admin account only using Javascript?

Could anyone suggest a way to use Javascript to check whether or not the logged in user to a SharePoint site is Admin? We need to hide some of the SharePoint's MasterPage ContentPlaceHolders if the ...
5
votes
3answers
25k views

SharePoint COM - SP.ClientContext(siteUrl) - Object doesn't support this action

Using the SharePoint COM to update a list item, but my function is failing. function updateProjectEC(projID, totalEC) { if(totalEC !== 0) { console.log("projID: " + projID); ...
5
votes
2answers
18k views

SPService GetListItems with CAML : can't get example to work

enter code hereI am using an example I found on codeplex of SPServices with CamlQuery to try to get list item values with where clause on the ID. For whatever reason this doesn't seem to work for me; ...
5
votes
4answers
16k views

Closing a modal dialog using a custom form

I am using some JavaScript (Client OM) code to open a dialog. Here's a snippet: function OpenModalForm() { //snip var opt = { url: url, width: 800, height: 600, ...
5
votes
4answers
5k views

jQuery and SharePoint 2010 - How can I tell is the page is in edit mode, using javascript?

I have some javascript in a CEWP that I want to execute only when the page is in display mode. I've used firebug to scour the page for some "msEditMode" type of variable or something I can rely on. ...
5
votes
2answers
191 views

Creating a JavaScript file which can trigger 2 clicks events to select the web part default view

I have spent many hours to try to write a script which allow me to do the following :- Currently i have a Discussion Board list which contain many items. where inside my site home page i added a new ...
5
votes
1answer
2k views

How to show and hide a paragraph in html when a button is clicked?

I have the following query. I have a <pre> tag and it has some text inside but i want to hide <pre> when a button is clicked. Following images shows code: When this addNewTest() function ...