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)

3
votes
2answers
8k 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
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
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
3answers
280 views

In 2013 using JavaScript how do you empty a people picker field?

In SharePoint 2013, I want to delete all existing values in a people picker field using javascript or jquery. Simply using .removeAttr('value') or .val("") does not work.
3
votes
3answers
761 views

Add Ribbon Button via JavaScript

I have specific requirements from my client that he wants to add some additional Ribbon Button "but only" via JavaScript (including EnableScript reading value from some other list). They don't want to ...
3
votes
2answers
1k 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
3answers
2k 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
1k 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
5answers
2k 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
1answer
8k views

ExecuteOrDelayUntilScriptLoaded with sp.js when in debug mode Object Expected

I currently have a JavaScript file that gets loaded in my SharePoint pages. jQuery(document).ready(function() { ExecuteOrDelayUntilScriptLoaded(myfunction(), "sp.js"); }); myfunction = function(){ ...
3
votes
2answers
483 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
14k views

Calling the SP.UI.ModalDialog.showModalDialog method

My SharePoint solution has a userControl that Register a js block string getJS(string title, string htmlContent) { return (string.Format(@" ExecuteOrDelayUntilScriptLoaded(function ...
3
votes
2answers
850 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
12k 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
3answers
6k views

How to get list by url using client object model?

Is it possible to get list by url using ECMA script client model? For example something like this: context.get_web().get_lists().getByUrl("Lists/MyList");
3
votes
3answers
319 views

Combine REST query “GetItems” action with OData $filter parameter

I'm able to call GetItems through REST by using an example by Erik C. Jordan. Now I'm trying to combine this with a simple OData $filter parameter. I have a REST query like this (jQuery on SharePoint ...
3
votes
1answer
178 views

get_defaultViewUrl () not working in SP Hosted app

I am trying to get the default view url of a list in SP hosted app. Below is the code i am trying, on execute success method. spListobj.get_defaultViewUrl(); It is returning me this error : The ...
3
votes
2answers
789 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
2k 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
2answers
4k views

Using Sharepoint client API to upload file as attachment in javascript

is there a way to upload file as attachment while using JavaScript client object model in sharepoint 2013? Or using web service in the middle is required? I cannot use FileAPI from HTML5. Thank you ...
3
votes
2answers
483 views

How do I programatically change the default value of, or remove from default view, title column using javascript?

Using the JSOM in SharePoint 2010, if I am creating lists programmatically using something like: this.myField= oList.get_fields().addFieldAsXml('<Field DisplayName=\'Key\' Type=\'Text\' />', ...
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
3k 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
879 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 ...
3
votes
2answers
2k views

Page.ClientScript.RegisterClientScriptInclude in Sandbox?

I'm trying to use jQuery in a Sandboxed Visual WebPart (2010): protected void Page_Load(object sender, EventArgs e) { string jQuerySrc = Page.ClientScript.GetWebResourceUrl(this.GetType(), ...
3
votes
4answers
6k views

Loading jQuery in the Correct order

I wish to use a jQuery plugin in SharePoint. Currentley I have jQuery added to each page via a custom master page. <script src="/Style Library/js/jquery-1.6.4.min.js" ...
3
votes
2answers
376 views

Can all the /_layouts/xxx.debug.js files not be served to end users?

I'm working with a 3rd party vendor who has done the SP 2010 integration of a small site. I've noticed that our incredibly simple login page is nearly 3.2 megabytes. The users of this site are the ...
3
votes
2answers
60 views

XsltListViewWebPart and custom link column

I have a XsltListViewWebPart with a custom link column used for change a value on current listitem using JavaScript. <a href="javascript:ApproveRejectRDA('{@ID}', true);" title="approve"> ...
3
votes
1answer
293 views

Create a document set with JSOM

I'm trying to generate document sets on the fly with the following code. It is using /_layouts/15/SP.DocumentManagement.js for the SP.DocumentSet.DocumentSet.create method which takes four parameters. ...
3
votes
1answer
952 views

JSOM - get listitem by file URL

Task Abridgment - Access item attribute from a picture library by picture url. Long - When editing a pagelayout and an image is added to the page, the image's description should be loaded. This is ...
3
votes
1answer
269 views

Get MySite URL using ECMA

I am trying to get the URL of the logged in user's Personal site from another site collection. I am working on SharePoint 2013 online and using ECMA.
3
votes
1answer
712 views

How can you get a user's mysite image url based on a list's AuthorId?

I have a list that I am using SharePoint 2013's rest API to grab info from. I would like to display an image of the user who created the list. This site shows how to get a user's image url based on ...
3
votes
1answer
4k views

SP2010 Javascript REST API: updating list item using MERGE and POST

I am trying to use REST API approach in javascript to update a sharepoint list item where I have an id. So I use GET and POST to create records, but per MSDN article it looks like the way to do this ...
3
votes
2answers
2k views

SP 2010 - Client object model (javascript) - How to use get_listItemCollectionPosition for paging?

This is my code: When I call the function to get the items, it fails (doesn't go to the fail function, it goes into the success function but crashes when I try to get the position object), and I get ...
3
votes
2answers
3k views

SharePoint 2013 lazy load for .click() issue

With IE 10 and Chrome 26 on Win7 x64 (Host1) no issues are appearing, except Firefox 20. With IE IE 8 on Win7 x64 (Host2) and IE 10 on Windows Server 2012 x64 (Host3), there is the following issue I ...
3
votes
3answers
2k views

JavaScript and CSOM Unable to update a new item lookup field with a string

I have a list MyUsers that has a lookup field deptRef that references the Title in my departments list. Fine and is easy for my users to update the MyUsers list and select the relevant department. ...
3
votes
1answer
991 views

Best way to access SharePoint (online) from a Windows 8 RT/Metro application?

I am developing a Windows 8 tile app/Metro (Windows RT) application. I have experienced some problems linking with the C# client object model assemblies due to limitations in RT. I was hoping I ...
3
votes
3answers
1k views

ECMA script - retrieving SPList property bag

I have added a property bag to SPList. Since the SPList doesn't support property bag, I have added my custom property to SPList.RootFolder.Properties. I would like to retrieve this property using ECMA ...
3
votes
6answers
9k views

SP.UI.ModalDialog.RefreshPage from the dialog itself?

I have customized the display form on one of my list. On a webpart page, I have drop a view to this list. When I click on the title of my item, the custom disp form is shown as expected in a modal ...
3
votes
2answers
627 views

Client Object Model equivalent of SPWeb.SiteLogoUrl

I can get the name, url and description of a site using SP.Web but there is no logo property. Is there a javascript COM equivalent to ...
3
votes
2answers
735 views

SharePoint webpart and application page

I need to make an application page or a webpart that have a javascript code and i tried to add the jquery i a new project to upload it to the SharePoint but the code didn't work this is the code that ...
3
votes
3answers
511 views

jquery projects and visual studio best practices?

Just curious how others are handling their jquery related solutions. It's obviously very easy to add a Content Editor web part with a content link to a source file. That file could have your ...
3
votes
1answer
570 views

What are CUI.debug.js files and why are they needed?

Our server has had some issues lately and we've been keeping our eye on the processes running. One process taking up a lot of memory is using CUI.debug.js. I'm assuming it's used for debugging? What ...
3
votes
2answers
1k views

Stop deletes via EditForm.aspx using SP.UI.ModalDialog.showModalDialog going to List view page

If you use SP.UI.ModalDialog.showModalDialog to show a Lists standard EditForm.aspx the callback (dialogReturnCallback) is hit for cancels and edits but not deletes which are instead redirected to the ...
3
votes
1answer
2k views

Getting date and time from SharePoint Server 2007 and throw it to Javascript variable

How to I get the date and time from SharePoint Server 2007 and pass this value as a Javascript variable?
3
votes
2answers
1k views

Web Service UpdateListItems User Permissions

I'm trying to do an AJAX SOAP call to the Lists web service, specifically UpdateListItems. The query isn't malformed, and is working appropriately when using a user with full permissions. When a ...
3
votes
1answer
50 views

Can I immediately call a function when selecting data in a SharePoint 2010 choice field?

I am trying to show/hide other fields depending on the choice selected from a specific choice field in my SharePoint form (NOT InfoPath). I can get it to work using "onfocusout" but that does not work ...