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.

learn more… | top users | synonyms (2)

4
votes
3answers
739 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 = $("#" + ...
4
votes
2answers
178 views

Is it possible to Fire event when Content type added in Shared Documents in sharepoint 2010?

How to fire event when any content type added in shared document library ? How to handle this event ?
4
votes
1answer
554 views

disabling javascript from overriding breadcrumb navigation styling

I've used some CSS to restyle the titlebar breadcrumbs in a SharePoint 2010 mysite. .s4-title h1 a, .s4-title h2 a, .s4-titlesep h2, .s4-title h2, .ms-ltviewselectormenuheader .ms-viewselector a { ...
4
votes
3answers
4k views

How to get SP.Folder for SP.ListItem in SharePoint 2010 JavaScript Client Object Model?

I have a custom button on ribbon for document library and need to disable it if current SPListItem is an empty folder. To disable button I use EnabledScript attribute of CommandUIHandler. I can get ...
4
votes
1answer
508 views

In SharePoint 2010 how can I add user selected WebParts at run time?

I am quite new to SharePoint and have been given an interesting problem to solve. My users have requested to each have a custom home page that they can customise with ease. The design I have been ...
4
votes
4answers
363 views

Retrieve All list items with AngularJS and ClientContext

I would like to ask you if there is a possibility to use ClientContext with AngularJS? In this way I want to take all items, sort them, filter, make some modification and etc. Later maybe I will add ...
4
votes
1answer
168 views

Getting error while uploading multiple files in sharepoint hosted app in 2013 with REST API

In one of my tasks,i was struck with one issue,that is "While uploading multiple files into document library with REST API". Iam trying to upload multiple files in library with REST calls for an APP ...
4
votes
1answer
187 views

SP.ScriptHelpers object

Just noticed the object the other day, and it looks like its on every page. But I can't find any documentation about it. Anyone used the "helpers" or seen any docs, or knows anything about it? Tbh ...
4
votes
1answer
179 views

How can i add a custom tab to a ribbon at runtime using javascript/ECMAscript?

I'm trying to add a Custom tab with a group and some buttons to a single client via conditional javascript, as far as i can tell this is all found in the CUI namespace, however documentation is hard ...
4
votes
2answers
566 views

Create Page using REST API

I have spent two days trying to create a page with a specific Content Type in Pages list using REST API. It goes into error handler and returns ...
4
votes
1answer
134 views

sharepoint 2010: javascript rest api not returning full decimal values, truncating to tenth

I have a list with a several columns that have number values to fourth decimal place, and I am using javascript com to get data via rest GET request and following simple callback function ...
4
votes
3answers
881 views

Commit modal dialog and then display notification

I have a modal dialog that I commit by calling window.frameElement.commitPopup(), and this is great because it refreshes the parent window. However I would also like to display a notification on the ...
4
votes
1answer
179 views

SharePoint XML Web Part dynamically adding xml link

Is there a way to dynamically insert a variable in the <XMLLink> --variable here--</XMLLink> tag? I'm trying to read an URL parameter which will contain the xml files path. What I am ...
4
votes
2answers
2k views

Copy file using javascript client object model - new version

I have a solution that adds a custom button to the ribbon in SharePoint 2010 and am using the javascript client object model behind the scenes to copy a file from Library A to Library B when the ...
4
votes
2answers
599 views

Object #<Object> has no method 'showModalDialog'

Consider the following code: var options = { title: 'Create a new Post' autoSize: true, url: url } SP.UI.ModalDialog.showModalDialog(options); The code is executed from a ECB custom ...
4
votes
1answer
199 views

Getting ctx for a specific webpart

My goal is to replace a text in a specific column by an icon using only javascript. function ReplaceTxtbyIcn(targetWP, targetColumn, pat, urlname) { var table = document.getElementById(targetWP); ...
4
votes
1answer
429 views

List Picker Dialog

I am attempting to use LaunchPickerTreeDialog js method to launch the OOTB SharePoint list picker. It works fine when selecting a list within the current web application however if I pass a parameter ...
3
votes
3answers
610 views

how to determine if a page is checked out? Client side, using javascript?

I need a way to determine if a publishing page is checked out by the current user; I need this because I'd like to put a redirect, if the page is not checked out. Any ideas?
3
votes
2answers
24k views

SP.ClientContext.get_current() returning undefined objects

I am trying to get some information about the current context through the sharepoint javascript object model and am getting annoying errors. $(document).ready(function () { ...
3
votes
6answers
2k views

Enforce Drag and Drop documents to apply metadata

We have implemented an issue management system in SharePoint 2013 which provisions a page for every issue added to a specific list. One of the Web Parts the automatically provisioned page contains ...
3
votes
2answers
499 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 ...
3
votes
5answers
3k views

SP.ClientContext is always “undefined” in JSLink functions

I'm trying to execute CSOM functions as part of a JSLink extension to override rendering of a Lookup Field. Problem is every time I try to access SP.ClientContext it returns as undefined I have ...
3
votes
3answers
7k views

Get User via JavaScript Client Object Model

Is there a way to get user information via the JavaScript Client OM? Something similar to the clientContext.Web.EnsureUser(userName) method. I am aware that there is the SPService JQuery library, but ...
3
votes
1answer
226 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
3answers
2k views

Query SP2013 Managed metadata term store

I was wondering if it is possible to query the Term Store via the REST API or Javascript Client Object Model in SP2013. I can't quite seem to work out the naming scheme for the REST API to discover ...
3
votes
2answers
789 views

Get UI language name in javascript

I need to get the name of the current UI language in a javascript file. I know the following trick: SP.Res.lcid But that gets the the LCID. What I really need is the two-letter iso name (like 'en', ...
3
votes
2answers
7k 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; ...
3
votes
2answers
2k views

SPservices to retrieve version history of items in SharePoint List 2007?

May I know how can one use SPServices to retrieve all the version history of a particular items in a SharePoint 2007 Server List? (If it is not possible via SPServices, are there other Javascript ...
3
votes
2answers
4k views

Path to jQuery file for SharePointWebControls:ScriptLink

I'm working in SharePoint 2010 Designer to create a custom page layout. I've added a SharePointWebControls:ScriptLink control but am not sure what the path is to my jQuery library. It's uploaded to ...
3
votes
5answers
2k views

Why am I unable to save JavaScript in a Content Editor Web Part?

I am trying to follow this link and put all the code in a CEWP as suggested. After saving the page the code goes away (except for the gear part, top line). I could really use some help if possible.
3
votes
3answers
985 views

How to find the current folder through JS COM?

Is there a way to get a reference to the current folder through the JS COM? It doesn't seem as though it can be done with SP.ListOperation. And by current folder, I mean the folder the user is ...
3
votes
2answers
516 views

View custom field property value using JavaScript

I'm using SharePoint 2010. Need to retrieve the Custom field property values using a JavaScript. [Trying to do this during item click in the SharePoint list item view. I call the JavaScript on the ...
3
votes
2answers
12k views

Get current user in Client Object Model with javascript?

var ctx = new SP.ClientContext.get_current(); var web = ctx.get_web(); ctx.load(web); var user = web.get_currentUser(); alert(user); I used above code to get the current user using JavaScript, but I ...
3
votes
1answer
596 views

JS CSOM in Custom .HTML File

I am building a SPA using SP 2010 as my back end but with custom HTML/CSS/JS deployed to a subfolder of _Layouts. I get everything I need from ListData.svc with the exception of the current logged on ...
3
votes
1answer
1k views

access a list in a subsite with Javascript

How can i access a list in a subsite? function Read () { var caml = "<View><ViewFields><FieldRef Name='Title'/><FieldRef ...
3
votes
2answers
443 views

calling click event on dynamic controls

What I have is fairly standard code for using JavaScript with SharePoint 2013. Inside the sharePointReady function, I have a few dynamic controls that are added to the page. The problem is that when ...
3
votes
1answer
1k views

JavaScript OnLoad and SharePoint does not work

I have tried this <script type="text/javascript"> function myfunc() { ExecuteOrDelayUntilScriptLoaded(GetSuppliers, "Directory.js"); }; ...
3
votes
1answer
2k views

no sorting with JavaScript Client Object Model?

I have the following JSOM code: var query = "<View><Query><Where><Eq><FieldRef Name='Category'/><Value ...
3
votes
2answers
784 views

ScriptManager ServiceReference in SharePoint

I have always used jQuery.ajax to retrieve data from listdata.svc or lists.asmx in SharePoint and from some custom web services. Now I will try Microsoft Ajax Library and especially ServiceReference ...
3
votes
8answers
9k 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 ...
3
votes
3answers
3k views

Sharepoint - Calculated Column showing different colours based on list item age

Marc, I understand you are a busy man, but if you can spare atleast sometime to my query below then I will really appreciate the gesture. Background: We get several requests (items on SharePoint ...
3
votes
1answer
2k views

How to import external javascript in a User Control?

I have a code-behind User Control (myUserControl.ascx and myUserControl.ascx.cs) that are in ControlTemplates/MyFolder/ and, in the code of myUserControl.ascx I need to use some javascript ...
3
votes
4answers
4k 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. ...
3
votes
2answers
352 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(); ...
3
votes
2answers
278 views

getting Regional settings in Javascript from CSOM

I am creating a custom data entry app in sharepoint using the CSOM. I need to update the default value of a datetime field, I can get the default value but the datetime is in UTC Format. I need to ...
3
votes
1answer
652 views

Help with getting the value of a look up field

Currently, I am using an ajax request to access the list items. The fields that are not lookups come as expected but the lookup fields come across as an ID of the object that corresponds to its ...
3
votes
6answers
1k views

How to run javascript code only when list item gets deleted?

ANSWERED! See bottom of original question for the working answer. I'm trying to find out how I can run a piece of JavaScript code the moment a list item gets deleted. So it should be some sort of ...
3
votes
3answers
2k views

Prevent/override standard Modal Dialog close button(X) from closing

I want to validate custom modal dialog form and if its not ok, prevent form from closing. For this purpose, I attached to X-close-dialog-button. Problem is to prevent it's default behavior. function ...
3
votes
2answers
2k views

CustomAction: UrlAction to open link in a new window

I have added a menu item to the Personal Actions menu by creating a CustomAction like so: <CustomAction Id="myCustomAction" GroupId="PersonalActions" ...
3
votes
1answer
794 views

Hide upload Button on Asset Selector Dialog (AssetPortalBrowser.aspx)

I am looking to hide the "Upload" button in Asset Selector Dialog and I know Asset Selector Dialog uses Dialog.master in SharePoint. Is there a possibility to attach some custom jQuery/Javascript ...