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
0
votes
1answer
459 views

JavaScript code block messing with drop-downs in Menu

I am using SharePoint 2010 and I need to place the following JavaScript code on a page to give me time in Rome <SCRIPT LANGUAGE="JavaScript"> function GetTime() { var dt = new Date(); ...
0
votes
1answer
2k views

Refreshing a Web Part Without a Post back in SharePoint 2013

I have a list with many columns in SharePoint 2013, I used SharePoint designer 2013 for displaying items , I have tow web parts in a page that I created in SharePoint designer 2013, one web part ...
0
votes
4answers
714 views

Getting Current User - On Page Load (JavaScript)

Basically, what I want to achieve is to hide particular elements in all SharePoint sites within a single farm. What I did is I created a SiteCode.js file inside the Site Assets folder and filled it ...
0
votes
4answers
2k views

Unable to get property 'STS' undefined or null reference - Sp.ui.dialog.js

My problem is that when I start my app for the first time,it shows me an error. The error is: Unable to get property 'STS' undefined or null reference. If I refresh my app then the error disappears. ...
0
votes
1answer
2k views

Invalid field or parameter requestInfo.url. in SharePoint hosted app

I am working on SharePoint hosted app. I am facing an error in the beginning of the app i.e. "Invalid field or parameter requestInfo.url." This error is came from bellow code: function execOperation(...
0
votes
2answers
2k views

Change file name

I am updating a file in document library using a Put request from the client side. I need to know, how to change the file name after the file has been updated. My upload code is working fine. I can ...
0
votes
2answers
2k views

Autocomplete people picker in sharepoint2010

I have a problem in which I have to add an Auto Complete functionality for a new people picker of Sharepoint list newform.aspx While Googling I found this https://www.nothingbutsharepoint.com/sites/...
11
votes
4answers
36k views

Uncaught TypeError: Cannot read property 'get_current' of undefined

this one is weird I hope somebody can help me. I created a custom action for a callout on a document library. I added the javascript code in a code snippet webpart on top of the document library ...
10
votes
4answers
25k views

Unable to get property 'get_current' of undefined or null reference

$(document).ready(function () { var count = 0; retrieveCurrentListProperties(); function retrieveCurrentListProperties() { clientContext = new SP....
8
votes
3answers
2k views

Unable to set “End Time” of Calendar through Javascript

I am trying to set default value of "End Time" field in Calender NewForm.aspx page. Here is my code: var txtDate = $("#" + $("label:contains('End Time Date')").attr("for")); var cboHours = $("#" + $("...
8
votes
2answers
189 views

How to add scripts to a site collection without modifying the masterpage

Our company has restricted any modifications to 2013 SharePoint masterpages. For the most part I have been using layout pages to add scripts however if a site is not a publishing site, I am looking ...
7
votes
1answer
2k views

Get List Template ID JavaScript

I have some code that returns all of the lists in my site however I need to only get lists that are using the discussion board template and I have hit a stumbling block with this. I currently have ...
7
votes
2answers
29k views

Uncaught Error: The property or field has not been initialized (I have tried many solutions…none seem to work)

Uncaught Error: The property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested. Even after explicitly including ...
5
votes
2answers
8k views

JSLink Client-Side Rendering Not Functioning on Custom List

I tested out the use of JSlink on the homepage with a demo list & it worked fine. I then used the same JSLink on the Demo List itself but images did not render. Any ideas on what I'm missing? ~...
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
2answers
6k views

Run javascript after display template loaded

How can I run some JavaScript after my display template has loaded. I have tried: AddPostRenderCallback(ctx, function () { jQuery(document).ready(function () { alert(jQuery('.ms-srch-...
5
votes
1answer
6k views

The field 'EventDate' of type 'DateTime' cannot be used in the query filter expression

I am trying to filter standard Calendar events via SharePoint web api and my query looks like this: /_api/web/lists/getbytitle('calendar')/items?$filter=( EventDate ge datetime'2013-01-26T22:00:00Z'...
5
votes
2answers
3k views

How to design the SharePoint List NewForm.aspx?

In the SharePoint List NewForm.aspx I have to design the form like two text boxes side by side with the headings? Is it Possible to design like that? Can any one help me on this issue?
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
1answer
6k views

JS Web Worker and SP.JS - Type is not defined

I'm experimenting with using CSOM and Web Workers as many of my users use Chrome and FireFox. Currently I am importing SP.js and SP.Core.js importScripts("../SP.js", "../SP.Core.js"); What other ...
4
votes
3answers
4k views

Add multiple people using Javascript Client Object Model to a Field of Type SPFieldUserValue

I want to update a UserField client side. I found the following code at this topic How to Use ECMA CSOM to Set a Field of Type SPFieldUserValue Tried the following code: var users = new Array(); ...
4
votes
3answers
9k views

Expanding and collapsing sharepoint webparts

I want to implement a collapsing/expanding feature to all my webparts in a certain page and tried the code shown here: http://moblog.bradleyit.com/2009/08/sharepoint-expand-or-collapse-web-parts.html ...
4
votes
2answers
38k views

Need help figuring out why a JavaScript button onclick is not working [closed]

I have a Sharepoint2010 site and am trying to execute a Javascript code to create some drop down selection menus with a GO button at the end. The GO button is supposed to run a function that does a ...
4
votes
2answers
11k views

Get a list Id using javascript?

I'm trying to trigger the NewForm.aspx of a list by clicking on a link. I would like to known how to get a list ID using JavaScript (Or jQuery)? (SP2010) I've already tried : var context = new SP....
4
votes
1answer
689 views

REST API compare current user if exist in a custom list

I have a custom list with 37 user fields, I need to check if the current user is in one of those fields to display an alert. I'm getting the current user with this url: /_api/web/currentUser And ...
4
votes
1answer
4k views

Can I Access the SPAuditQuery from the JavaScript Class Library?

Or there's a SP2010 Built-in service to access Audit data? [UPDATE] Quick awnser, No, there's no way to access the SPAuditQuery from the SP JavaScript Class Library. At the end I end up using a WCF ...
4
votes
1answer
2k views

Update readonly field using REST API

I am trying to update a list item using Rest API. Following is my code. It works and it updates all fields except "RichMessage" which is a Note field with RichText="TRUE" and readonly. I have tested ...
4
votes
3answers
6k views

Javascript works when on edit page but not when page is published

I have a page on my sharepoint site, when i'm on the edit page the javascript works however when I have published the page, the javascript doesn't work. I have added the link to the javascript file in ...
4
votes
1answer
2k views

Check if a document set exists

I'm trying to determine whether a document set exists - if it doesn't I'll send it off to another function to create but I'm not getting the correct value back from my query. I think it has to do ...
3
votes
1answer
4k views

Sum Calculated Column (SP 2013)

There is a very nice solution below from ViewMaster (http://www.viewmaster365.com/#/Create/Sum) that involves some scripting within the formula of a calculated column itself. However, the Sum will be ...
3
votes
1answer
2k views

Reference JScript files at the end of page using ScriptLink Tag

Due to performance problems, we decided to reference javascript files at the end of the master page file. However, if we reference javascript files at the end of master page using ScriptLink Tag, the ...
3
votes
2answers
124 views

Top Naviation Menu is not loaded when script runs - SharePoint Foundation 2013 Oslo Master Page

I am trying to find the Top Navigation menu elements that are in the top part of my master page. So at the bottom of my master page I have added a script to fine the element on the page as follows: ...
3
votes
2answers
1k views

Can I use JavaScript in 'Edit in DataSheet' mode?

I would like to use some JavaScript in 'Edit in DataSheet' mode to check a value and prompt a user to enter some text. Is this possible?
3
votes
1answer
908 views

Upload document to a specific folder in a Document Library using JavaScript

I Want to upload document to the Document library's specific folder using JavaScript/JQuery. I tried with the below code. But I can upload documents to the root folder only not to the specific folder. ...
3
votes
1answer
211 views

SP2013 - Failed to call, back to back executeQueryAsync() functions

This is exactly what I want to accomplish, given below are the steps I'm performing. Update sub task status based on subTaskId (SP Task List), using executeQueryAsync() Get all sub tasks based on ...
3
votes
3answers
9k views

Sharepoint- Client Object Model - Javascript - How to check if a particular file with same name exists in a document library folder

I am using javascript sharepoint 2013. I want to know how to check if a file exists in a folder, before i upload. Here's my code // Folder Name - folder into which I need to upload var ...
3
votes
3answers
2k views

How to HIDE selected sharepoint list fields/Columns using Javascript or Jquery on VIEW page?

Please Help! I have a custom list with 3 columns, "Slno","Language","Status".Status is a choice field with choices "Ongoing" and "Terminated". The Color of the "Language" column changes based on the "...
3
votes
1answer
3k views

SharePoint Ribbon Loading endlessly

i'm a beginner of SharePoint.I'm using 2010version. Here i'm facing a problem that the ribbon of my root site is loading endlessly. I could not use the options like page, Edit,site action etc.. but ...
3
votes
1answer
1k views

ECMA/js CSOM retrieving items from multiple lists with async processing? how?

I am struggling with javascript and learning callbacks, and applying this to SharePoint 2010 specific js/jquery methods of getting and savings values from lists. So I am recently getting into the ...
3
votes
2answers
1k views

sharepoint 2013 button onclick event gets removed after page save

I am trying to call a Javascript function through a button I posted on my sharepoint page like so <button type="button" onclick="myFunction(); return false;">Button</button> But after I ...
3
votes
1answer
1k views

Add javascript code to Document Library default view

I tried to find "Edit page" option but could not find it. Is it possible to add some .js file into a specific view?
3
votes
2answers
2k views

Use SP.SOD.executeFunc in SharePoint Online Add-In

I want to use something like the following in a SharePoint Online add-in to delay the firing of resetPage(): $(document).ready(function () { SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function ...
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
62 views

Output of Date of birth column is coming as Tue Dec 15 10:30:00 UTC+0530 1992

I want output as "15/12/1992". My code is as below: function OnLoadSuccess(sender, args) { var listItemEnumerator = collListItem.getEnumerator(); while (listItemEnumerator.moveNext()) { ...
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
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
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
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
2answers
9k views

Get web title from ClientContext using URL?

I have the URL of a web (http://intranet/sites/site/web) and I would like to get it's title. I know in PowerShell or C# you could create a Web object from the URL and get the title. Can you do ...
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 ...