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)

5
votes
2answers
908 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
2answers
7k views

How to return a value using context.executeQueryAsync?

How can I get this function to return the value? In all the examples I have seen, folks use an alert in the delegate functions, but I need to return the value instead. When I call the function, it ...
5
votes
2answers
1k views

Javascript Client object model, rename folder

Hey 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 ...
5
votes
2answers
3k views

moveTo and moving documents from one library to another

I have followed and successfully implemented the excellent article: SharePoint 2010 ECMAscript – Copy\Move files to another document library – Part 2 located at: ...
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
2answers
1k views

How to retrieve distinct values with JavaScript Client Object Model

How can you get distinct values from a SharePoint List column using JavaScript without a huge performance hit? A simple example would be appreciated :)
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
3answers
917 views

Replace semicolon delimiter in a Lookup column on the list view

When selecting multiple values, the data is separated with semicolons. When many values are selected it starts looking cluttered. Is there any way to have each value on a new line? For example, ...
5
votes
1answer
77 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
881 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
360 views

Reload Calendar without refreshing page in SharePoint 2010

How to reload calendar without refreshing whole page ?
5
votes
1answer
141 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
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() { ...
4
votes
5answers
772 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 ...
4
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 ...
4
votes
4answers
4k 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
9k 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
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
4answers
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 ...
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
958 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
9k 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
438 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
1k 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
669 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
664 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
8k 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
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
1answer
124 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
1k 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
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
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
687 views

ddwrt:EcmaScriptEncode Explained?

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

Format Date using Javascript Object Model

I am using the javascript object model to get a date field back and display it on a page e.g. oListItem.get_item("MyTestDate") This displays on the page by default as: Thu Jul 25 09:30:07 PDT 2013 I ...
4
votes
2answers
550 views

How to change webpart custom property in sharepoint 2010 using javascript?

I want to change Custom Property of Webpart using javascript. Does anyone have any ideas on how to accomplish this?
4
votes
2answers
2k views

Trying to redirect after closing Modaldialog, but parameters aren't set

I have a layouts page which creates a new site. I use SP.UI.ModalDialog to show the site. I've created the following js function I use to pop it up: function PagePopupAndRedir(fileUrl, fileTitle, ...
4
votes
1answer
71 views

SharePoint 2010 - Using REST to validate unique list item

I'm attempting to validate that a duplicate combination of staff (person/group field) + parent ID (lookup field) does not already exist in a list. Below you can see that I've added an ajax call to the ...
4
votes
1answer
182 views

SP.UI.Status anonymously inaccessible

Using Office 365 (SharePoint Online) I have stumbled into an annoying thing. Some parts of the JavaScript CSOM does not seem to be accessible when your browse the site anonymously. If Firstly I tried ...