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
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
1answer
5k 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

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
808 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
4answers
750 views

How can I disable the Document Library drag and drop function?

Before I start - I'm new to this SharePoint development lark and am slowly familiarising myself with it. We're using SharePoint online and I have amended the SharePoint out-of-the-box document ...
5
votes
2answers
634 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
285 views

Reload Calendar without refreshing page in SharePoint 2010

How to reload calendar without refreshing whole page ?
5
votes
1answer
132 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
761 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
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
3answers
8k 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 ...
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
1answer
850 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
3k 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
2answers
7k 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
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
207 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
3k 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
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
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
5k 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
626 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
2answers
678 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 ...
4
votes
1answer
490 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
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
105 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
1k 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
4answers
7k 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
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
334 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
666 views

ddwrt:EcmaScriptEncode Explained?

Does anyone know exactly what ddwrt:EcmaScriptEncode does? (Which char mappings, etc.?) M.
4
votes
3answers
365 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
474 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
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
1answer
121 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 ...
4
votes
3answers
557 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
170 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
523 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
500 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
1answer
150 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
143 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 ...