Tag Info

New answers tagged

1

Thanks to Submits help for achieving my scenario. Here is the complete solution for the same. It will read the Image and Title from a library and when you click on it you can redirect to another page. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js "></script> <script type="text/javascript" language="javascript"> ...


1

This isn't the most elegant solution, so feel free to tweak: var row = document.createElement("tr"); var j = 0; for(i=0; i<this.pictureArray.length; i++) { //alert(this.pictureArray[i]); if (j == 0) txtHTML += "<tr>"; var fgh='http://google.com'; var res = this.pictureArray[i].split("/_t/"); var ...


2

Use _spPageContextInfo in your JavaScript. Usage: var url = _spPageContextInfo.webServerRelativeUrl; alert(url); See others here: http://blah.winsmarts.com/2013-2-_sppagecontextinfo_is_your_new_best_friend.aspx


0

If i understand your question, you need to populate the choice field in form with Choice field column from SPList. Correct me if i am wrong. In you code, i do not see the code to append the choice fields. Might be due to that, its just displaying last item from choice field. In loop , Could you try below line of code? liHtml += "<option value=''>" + ...


0

You should be able to use this too, $().SPServices({ operation: "GetUserInfo", userLoginName: $().SPServices.SPGetCurrentUser(), completefunc: function(xData, Status) { console.log($(xData.responseXML).find("User").attr("IsSiteAdmin")) } }); Note though, if your SCAs are defined by an AD group, this shows false, as in the ...


1

For 2013, Check this out using (var ctx = new ClientContext(webUri)) { var currentUser = ctx.Web.CurrentUser; ctx.Load(currentUser); ctx.ExecuteQuery(); Console.WriteLine(currentUser.IsSiteAdmin); } Greetings


1

I may not fully understand what you are trying to achieve. You want to display a 100x100 thumbnail of the Image in a Document Library and the image name is in the Title field? You can achieve this with a Calculated Column (set to datatype=Number): ="<IMG height=""100px"" width= ""100px"" src=""" &[Title] &""">" datatype Number wil be ...


0

You get [object Object] because you are looking at the toString of the jQuery object. If you use console.log, or a breakpoint, you will see the actual array, then you can even right click and reveal the element (if found) in the elements tab. Furthermore you can't call innerText on a jQuery object, what you are looking for is text().


0

No, there are no coverage for workflow or taxonomy in SP REST API. But you can use CSOM: Start SharePoint 2013 Workflows with JavaScript Client Object Model


0

Sample Code Snippet as below userid = _spPageContextInfo.userId; // Fetches the UserID of the Current Logged in User //Endpoint is /_api/web/getuserbyid('userid') var url = String.format("{0}/_api/web/getuserbyid('{1}')",siteURL,userid); $.ajax({ url : url, contentType : "application/json;odata=verbose", headers ...


0

After following this (Run JavaScript after "group by" in list has been clicked on and list data loaded) article I was able to get the following code working. <script type="text/JavaScript" src="/_layouts/jquery/jquery-1.11.0.min.js"></script> <SCRIPT type=text/javascript> $(document).ready(function(){ var oldExpand = ProcessImn; ...


0

Definetly we should not use 'id' or 'Class' for manipulating the elements. Instead we can use 'Title' for instance. Below is the example code to use. For Example i have select tag with the Title as Cars, i can get the value selected on the basis of Title name, instead of using its 'id' or 'class' <select id ="wp123123select" Title="Cars"> ...


0

I was able to get this working if my lookup has less tahn 20 items. However it is not working if i has more than 20 + items in Ie10. function ResetDropDownList(lookupcolumnName,NumStoreColName) { if(getField('select',lookupcolumnName)) { getField('input',NumStoreColName).value=''; $("select[title='"+ lookupcolumnName +"'] ...


0

You can get that element by getting that element value by title. For example if your inclusion field is input then you can use something like this jQuery('input[title="Inclusion"]').val(); This way I used to get the element values. In your case you need to check your DOM for your element type. Hope this helps!


1

Check out this article on ITUnity: Managing JavaScript References in Office 365


0

First, make sure you have a jQuery library referenced. Then this should work: Set value - $("#id").val("Hello World"); Get value - $("#id").val(); You should be able to see it happen instantly using Developer Tools.


2

Ah, it is working, but the URL to the picture is malformed, hence the x images. This is what worked for me: <script type="text/javascript"> $(document).ready(function(){ $("img[src$='icjpg.gif']").each(SetImage); }); function SetImage() { $(this).attr('height','100'); $(this).attr('src','/managedpath/sitename/library/'+$(this).attr('title')); ...


1

There seems to be a problem locating the parent href attribute. I did notice that the object itself has a title attribute. So here is a workaround: <SCRIPT defer type=text/javascript> $(document).ready(function(){ $("img[src$='icjpg.gif']").each(SetImage); }); function SetImage() { $(this).attr('height','100'); ...


0

This is because of the Label property Visibility="false". Instead use it as: <asp:Label ID ="lbMessageIndex" runat="server" style="display:none;"></asp:Label> then you can use: $('[id$="lbMessageIndex"]').html(); OR $('[id*="lbMessageIndex"]').html(); To get the label value.


3

I would use the REST API for this for sure and customize the OOTB list form with a typeahead or some other selection mechanism for the lookup. Even a selectable gridview might be better than a typical select. To filter using a typeahead sort of functionality you would use var filterString = "?$filter=startsWith('" + valueUserTyped "',Title)"; var ...


3

You can run the REST query in the browser to time it I have a list with about 30k items and rest works Okey but I don't select all of them though. I'd personally try angularJS together with the REST query to enable filtering for the users on the list but I'm unsure how well it will perform on such a large amount of items as I've never tried.


0

I finally found the solution using the activate event of the tabs: <script> $(function() { var tabCount = 0; $(".dfwp-item div.groupheader").each(function() { $("#tabs ul").append("<li><a href='#tabs-"+tabCount+"'>" + $(this).text ()+"</a></li>"); $("#tabs").append("<div ...


1

This looks to be malformed $("#tabs ul").append("<li><a href='"+encodeURI(test.aspx?Myfilter="+$(this).text())+"'>" + $(this).text()+"</a></li>"); try: $("#tabs ul").append("<li><a href='"+encodeURI("test.aspx?Myfilter="+$(this).text())+"'>" + $(this).text()+"</a></li>");


2

You could use the something like const string scriptKey = "jQuery"; if( !Page.ClientScript.IsClientScriptIncludeRegistered( Page.GetType(), scriptKey ) ) { Page.ClientScript.RegisterClientScriptInclude( Page.GetType(), scriptKey, ResolveClientUrl("~/js/jquery.min.js" ) ); } The key to making this work is that you need to include the same key ...


0

The reason is that the functions $includeScript and $includeLanguageScript will load the JavaScript files asynchronously. So that means that the files you want to reference will load randomly and so you could end up with errors like you are exeriencing. The best way to solve this is not to work with the $include functions, but use RegisterSod, ...


1

SPControl.GetContextSite Method expects HttpContext parameter, so replace the line: SPSite mySite = SPControl.GetContextSite(mySiteUrl); with: var site = new SPSite(mySiteUrl); Secondly, in order to utilize SPEncode class add namespace declaration: using Microsoft.SharePoint.Utilities; Thirdly, there is no need at all to use HtmlTextWriter Class ...


0

There are a couple of things you can check. Is the ScriptManager set with EnablePageMethods? Did you create a static method in your c# code behind with [WebMethod] attribute? You can refer these discussions to check more: asp.net ScriptManager PageMethods is undefined ASP.net PageMethods return undefined Execute server side code on close of a browser ...


0

First create a Datasheet view (ApproversList) and then disable Datasheet view in list settings. This way, the ApproversList will be still displayed as Datasheet but you will not be able to switch to DS view in other views. Basically, the property Datasheet (Specify whether the datasheet can be used to bulk edit data on this list.) in list settings just ...


0

"ping" being an entirely different protocol (and even layer) than HTTP, no, you cannot "ping" using JavaScript. Best you could do is try to access a web endpoint and see if you get a response.


1

Scriptlink works as well, just remove OnDemand="true" which requires calls to SP.SOD.execute or SP.SOD.executeFunc methods for any JS script referenced to execute. Detailed explanation has been posted here before: jQuery not being loaded from master page The above works provided if your jquery reference path is correct!


0

The issue was with the visibility. Control was not rendered when visibility was set to false. The fix is hide it using css. display:none



Top 50 recent answers are included