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)

6
votes
1answer
708 views

Get and remove all currently displayed notifications from SP.UI.Notify

I am sending a variety of notifications via SP.UI.Notify.addNotification("blah", true); setting the "sticky bit" to true so that the notification stays visible. When I display a second ...
5
votes
5answers
16k views

How to get current user with javascript?

I have a list . I want select items of list with a special quary.(get items that created with current user). Then get count of items. I use this code for get current user : function Initialize() { ...
5
votes
5answers
776 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
3answers
4k views

How to Use ECMA CSOM to Set a Field of Type SPFieldUserValue

I have a JavaScript array containing the string representation of some usernames (domain\username format). Using the JavaScript CSOM, what is the best way to create a new item and add those usernames ...
5
votes
4answers
6k 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
9k views

Cannot get field value of list item through JavaScript

I try to get the value of a list item (that is currently selected). I know that I must load it into the context but even with loading the field explicitly I get the following message. Microsoft ...
5
votes
8answers
20k views

Getting a count of list items in a list via ECMAScript

I have a SharePoint 2010 web site with a master page that has a counter on it. I'm trying to update that counter using the ECMAScript. The code I have falls nicely into the success method - but I ...
5
votes
1answer
469 views

structure of sharepoint javascript functions

I am trying to understand more the structure of javascript functions in SharePoint. Why does every function begin with som value than colon and semicolon like ULSrE8:; in spgridview.debug.js: ...
5
votes
5answers
5k views

Add Javascript to every page in Sharepoint 2013

I looked but from what I see most questions that have anything to do with this refer to an old version of Sharepoint where something is always different from what I see in SP2013. I basically just ...
5
votes
3answers
141 views

Updating a single list item based on relative URL

Is it possible, using SPServices, to update a specific list item when all I have is the file path? For example, I have a file located at /site/library/folder/file.txt and I want to update a single ...
5
votes
2answers
949 views

ScriptResx.ashx Not Working

I'm trying to use ScriptResx.ashx in an Application Page I'm building (just to test out the functionality) and every time I try to grab a resource from what should be a JavaScript object, SharePoint ...
5
votes
1answer
1k views

JavaScript Client object model, rename folder

I am trying to rename a folder inside a Document library. Right now I get my item and everything is good but when I try to rename it using set_item('title', 'NewFolderName') it crashes and unwinds the ...
5
votes
2answers
3k views

How to disable a ribbon button when a folder is selected

I have added a new button to the SharePoint ribbon for document libraries. This all works well and the button is enabled / disabled depending on the number of items selected... fine! I want to ...
5
votes
3answers
9k views

How to use JavaScript and CSS in a web part?

I am using SharePoint Server 2007 Enterprise with Windows Server 2008 Enterprise. I am using publishing portal template. I am developing using VSTS 2008 + C# + .Net 3.5 + ASP.Net. And I want to ...
5
votes
5answers
2k views

Include JavaScript in a feature

I remember seeing somewhere that you can include an external JavaScript file in a SharePoint feature if it is in the _layouts folder. For the life of me I can't remember how to do this!
5
votes
1answer
104 views

How configure Navigation Inheritance when create site with Rest API?

I wonder how do I keep the navigation bar of the parent site when I create a subsite. Below is the code I'm using to create the subsite and thought it might be some parameter that I could use to do ...
5
votes
2answers
958 views

Updating a Property w/ 2013 REST Api

I have a sharepoint hosted app that is succesfully able to add Read and Create files on the Host site (using the REST Api and SP.RequestExecutor). Now I am trying to figure out how to update ...
5
votes
1answer
378 views

Reload Calendar without refreshing page in SharePoint 2010

How to reload calendar without refreshing whole page ?
5
votes
1answer
143 views

Check if web is in pagepreview mode - ?pagepreview=true

How can I check if a page is in ?pagepreview=true mode? I've branded the sharepoint ribbon and need to check if a page is in pagepreview to get the site branded correct (js / css). Is there a way to ...
5
votes
2answers
1k views

Sharepoint page redirection using JavaScript

below I have some JavaScript which listens for mouse activity and starts a timer if there is no activity and then redirects the user to another page after say 2 minutes..The problem is that if I have ...
4
votes
4answers
5k 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 ...
4
votes
2answers
25k 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 () { ...
4
votes
1answer
3k views

Check if user is in a specified group

I would like to check with JavaScript if the current logged user is in a specified and specific group (for example called "Admins Group"). How can I do? Thanks
4
votes
2answers
10k views

ExecuteOrDelayUntilScriptLoaded not executing after page publish

In SharePoint 2013 I have a page that is using the Script Editor web part. In the script editor web part I have the following: ExecuteOrDelayUntilScriptLoaded(startIt, "sp.js"); function startIt() { ...
4
votes
4answers
3k 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 ...
4
votes
3answers
2k views

How do you allow Content Authors to add Javascript to a Publishing Page?

We have an internet-facing, SharePoint 2010, Publishing Site. The content authors that maintain the site are JavaScript savvy web designers. They would like to be able to add JavaScript to publishing ...
4
votes
2answers
1k views

SP JSOM: is there any way to get the group by name instead of getById(10)

is there a way I can use the below with something like getByName(thisGroup), instead of getById(10) in SP 2010 jsom: function setSomeUsers(dataObj, projGroup) { var clientContext = new ...
4
votes
2answers
3k views

sharepoint 2013 rest api upload image

I want to upload image or create image in Sharepoint 2013 document library using rest api (Javascript) my code to get bite array from input type file element is var reader = new FileReader(); ...
4
votes
1answer
2k views

how to get users from SharePoint user profile db using jquery

I just want to know, is there any way to get a SharePoint user using javascript / jquery from default SharePoint 2010 user profile db? My requirement is to form an array of all SharePoint site users ...
4
votes
4answers
10k views

“the HTML source you entered might have been modified”

"the HTML source you entered might have been modified" In SharePoint 2010, this is the scary message you get everytime you use the "edit HTML source" button with the Content Editor Web Part. In ...
4
votes
3answers
506 views

SharePoint REST API call with more than 500 rows

I have an AJAX call querying the SharePoint REST API which will return more than 500 rows: $.ajax( { url: _spPageContextInfo.webAbsoluteUrl + ...
4
votes
2answers
2k views

SP2010 REST API from Javascript: how to set multiple fields to filter on in the URL

weird but i can't figure this out or find a solution anywhere.... I want to filter on two values on a GET in REST URL from javascript. So since this is from ECMA I am just using filtering in the ...
4
votes
2answers
4k views

CSOM get list items, return simple data structure

If we take this code example, we can see we need to call a lot of methods to get to our results (.getEnumerator(), .get_current(), .get_title(), .get_title()) var siteUrl = '/sites/MySiteCollection'; ...
4
votes
1answer
1k views

SharePoint RTE: How to attach to mousedown events (like bold, italic does)

When clicking on bold text in the RTE (rich text editor), magically the ribbon button for bold: get's activated. The same happens for the other format option buttons you can see on the screenshot. I ...
4
votes
1answer
7k views

How to get all fields of a list using JS Client Object Model

Is it possible to retrieve all fields of a list (or default view) through the JavaScript Client Object Model and filter the fields on type (e.g. I only want the Choice fields). var clientContext ...
4
votes
2answers
681 views

Custom Delete Page Button

I'm trying to create a custom delete page button for my users on a publishing site that resides on the actual page. At first I thought it would be as simple as just copying the code behind the 'Delete ...
4
votes
1answer
703 views

Error using javascript to retrieve a SharePoint list's items

I am trying to use this method to query items of a column of a list in my SP site via javascript (the reason I am doing this is to display that info on the page by modifying the html tags in the DOM), ...
4
votes
4answers
9k 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, ...
4
votes
3answers
5k views

Sharepoint 2010. 'xsd is not defined' Error when trying to save edited list item or create new! IE9

In internet explorer 9 i have error when trying to save list item. Namespace prefix 'xsd' is not defined. Before that i have javascript error inside some sharepoint files. This error says really ...
4
votes
2answers
2k views

Sharepoint 2010 ModalDialog title

I am creating a popup window in sharepoint using this code in javascript. function openDialog(title, url, width, height, CallResult) { var options = { url: getUrl(url), title: title, ...
4
votes
3answers
2k views

Is it possible to launch local application (exe) from Ribbon control?

I would like to launch an exe from the users local system (assuming the exe exists locally) from a SharePoint ribbon control. Is this something that is possible to do? If it is, how do I do this. If I ...
4
votes
3answers
118 views

JavaScript is breaking my theme in SharePoint 2013

I am having an unusual problem. I have a site in SharePoint 2013 I just stood up, and starting to experiment with JavaScript and jQuery. I am using one of the OOTB themes, not ready to monkey around ...
4
votes
1answer
129 views

What is ULS2Vv:;?

I see that label in most SharePoint JavaScript libraries. I am curious - what's that used for? Example: EnsureScriptFunc("clienttemplates.js", "RenderUserFieldWorker", function () { ULS2Vv:; // ...
4
votes
2answers
2k views

Datetime update is one day off

I'm updating a list with a date field (just the date) using the ECMASCRIPT object model but when the date is inserted is one day off from the introduced date, It's literally making me pull my hair off ...
4
votes
1answer
3k views

Sharepoint 2010 Calendar View in Custom List Expand All by Default

For some reason the scripts I have found on the web (ie: http://social.msdn.microsoft.com/Forums/en-GB/sharepoint2010general/thread/a24da49a-7fc8-47c6-a125-95e4a5b2d095) are not working with a ...
4
votes
2answers
2k views

How to read a column type SPUser, DateTime, Currency with EcmaScript?

I have a list in SharePoint 2010 with some columns. All are default types. So I have "Single line of text" "Multiple line of text" "Date and Time" "Choice" "Number" "Currency" "Person or Group" ...
4
votes
1answer
2k views

JavaScript error using date picker inside an update panel?

I placed the SharePoint date picker control inside an update panel and when I click on the calendar it gives me this error: Microsoft JScript runtime error: The value of the property ...
4
votes
2answers
335 views

Dialog Framework References

One of the new features in SP 2010 is the dialog framework, so that the user is presented with a uniform UI. What are the best references or tutorials you've seen about this feature? So far, this is ...
4
votes
2answers
694 views

ddwrt:EcmaScriptEncode Explained?

Does anyone know exactly what ddwrt:EcmaScriptEncode does? (Which char mappings, etc.?) M.
4
votes
3answers
891 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 ...