Tag Info

New answers tagged

2

You would need to store the domain\username in a variable and make a call to the GetUserProfileByName operation to then get the managers name. http://spservices.codeplex.com/wikipage?title=GetUserProfileByName $().SPServices({ operation: "GetUserProfileByName", async: false, AccountName: yourmanagerVariable, completefunc: function (xData, Status) { ...


0

If you are using SP 2013, you can use Client Side Rendering to override how the fields are rendered in the new and edit form, and hide them that way. I have not personally done this (yet), but I know it is a mechanism that is available for customizing forms in 2013. Here is an article that goes in to CSR for list forms, and here is one that specifically ...


2

You can hide the fields by: $('nobr:contains("Item Number")').closest('tr').hide();


0

Sorry I wasn't reading your question clearly. The above script works if the user is explictly defined. However, there is no method in SPServices that expands group membership based on AD groups. You'll likely need server side code for that.


0

With this code you can get every picker's value: var ClientPickerDict = SPClientPeoplePicker.SPClientPeoplePickerDict; for (var propertyName in ClientPickerDict) { console.log(ClientPickerDict[propertyName].GetAllUserInfo()); } Here is an utility function i use - but you need to know the id. GetPeoplePickerValue: function (elementID) { /// ...


2

Try var peoplePicker = this.SPClientPeoplePicker.SPClientPeoplePickerDict.peoplePickerDiv_TopSpan; var users = peoplePicker.GetAllUserInfo(); for (var i = 0; i < users.length; i++) { alert(user.DisplayText); }


0

You can create custom list forms for NewForm.aspx/EditForm.aspx Check here you can remove the fields which you don't want to display Only drawback of this implementation is that if you add new column to list you will have to manually add the field to it again or recreate the form


2

You can try below script which will hide the table jQuery('input [title="Item Number"]').closest('table').hide(); If you want to hide on input box then use jQuery('input [title="Item Number"]').hide(); Update jQuery('input [title="Item Number"]').closest('tr').hide(); Update2 $('.ms-formtable tr').each(function () { ...


0

You can use dataview webpart from sharepoint designer and achieve this functionality. Yes, there is no only configuration way to achieve this. I think NEW image appearance configuration is of farm level. Hence it wont be a good idea to change this. You need someone with sharepoint designer skills.


0

On a SharePoint Web Part Page if you want to ensure that your JavaScript runs after everything is loaded then you can use one of the following SharePoint methods: ExecuteOrDelayUntilScriptLoaded(myFunction, "sp.js"); // or _spBodyOnLoadFunctionNames.push("myFunction"); The first one as the name suggests runs your function after a specific JS is loaded, so ...


1

You have to achieve this using JSOM (not JQuery, actually). When you try to get field that does not exists in list, you usually will get an exception from SharePoint. So the best way would be to get internal names of all fields, and iterate through them. Here is pseudo script: var fieldExists = false; var context = SP.ClientContext.get_current(); var ...


1

You can get it like this $(document).on("click", ".btn", function (e) { var x = $('.content > table > tbody > tr:nth-child(2) > td:nth-child(2)').text(); alert(x); }); Or you can use $(document).on("click", ".btn", function (e) { $('.content > table td').each(function(index){ if(index == 4) alert($(this).text()); ...


1

Its seems Microsoft is evaluating height value dynamically. Hence your code has no effect. You can try adding below CSS into your Master Page #resultcontent { height: 400px !important } .ms-pickerresultdiv { height: 400px !important }


0

SharePoint lookup consist of 2 parts: ID of the item in the list and the Value. You can't set lookup only by the value because they are not the unique and can be the same with another item in this list. You should specify ID of the selected element.


0

Lookup Column needs to be treated differently. The value pair should be like valuepairs: [ ["Request_x0020_Type", ["1;#Test1","2;#Test2"]] ], Where 1 & 2 are corresponding ID values of Test1 and Test2.


0

You would do something like this (untested and going from memory): $().SPServices({ operation: "GetTagsofUser", userAccountName: $().SPServices.SPGetCurrentUser({fieldName: "Name", debug: false}), completefunc: function (xData, Status) { console.log(xData.responseText); } });


0

I hope you dont mind but I decided to have a go at writing the code. This is what I came up with using promises. var ITSP = ITSP || {}; ITSP.SharePoint = ITSP.SharePoint || {}; ITSP.SharePoint.Init = function() { var deferred = $.Deferred(); ITSP.SharePoint.Context = SP.ClientContext.get_current(); var context = ITSP.SharePoint.Context; ...


0

Try below, $().SPServices({ operation: "GetListItems", async: false, webURL: "http://abc", //Site collection URL which has the required List data listName: "Medi", //Your list name CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>", //Add the internal names of required fields CAMLRowLimit: 10, ...


0

By default jQuery.ajax() is an asynchronous call. So, you may need to set async property to false. However, there is already a SharePoint ctx object which has a boolean property named CurrentUserIsSiteAdmin. You can use it instead of making a REST call. So the modified code will look like this: $(document).ready(function () { SP.SOD.executeFunc('sp.js', ...


0

Is the problem not that you should also have a deferred object for the IsSiteAdmin()? It will complete and run through to the next step and the ISSiteAdmin function will never have a chance to evaluate and change the IsSiteAdmin Boolean. I would add a deferred object to the first function call and then the when statement will wait both checks have been ...


0

The problem is that your CSS/JS/jQuery code will only run when the page is ready(), which happens once. When you navigate to another month, the color coding won't update. There is no easy solution if you want custom colors in SharePoint beyond those that you can set when you add a layer (a reference to a separate calendar). I wrestled with this one myself, ...


0

If it is in a different domain there are options (CORS) http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx


0

I usually use a variant similar to what eirikb describes in his comment: if(typeof jQuery == 'function') NotifyScriptLoadedAndExecuteWaitingJobs("jquery.js"); else if (LoadSodByKey('jquery.js', null) == Sods.missing) RegisterSod('jquery.js', '//code.jquery.com/jquery-1.11.0.min.js'); SP.SOD.executeFunc("jquery.js", "jQuery", function () { ...


0

jQuery deferred object can solve your problem. https://learn.jquery.com/code-organization/deferreds/examples/ Using the above concept you can make the asynchronous calls work in synchronous way. Let me know if you have more questions.


0

Try this Query CAMLQuery: "<Query><Where><Eq><FieldRef Name='school_x0020_id'/><Value Type='Text'>4440</Value></Eq></Where></Query>",


0

I see a couple things, eq should be Eq is school id the name of your column? Make sure the casing is correct. Lookup values should be represented like: <Eq> <FieldRef Name='RelatedIssues' LookupId='True' /> <Value Type='Lookup'>4440</Value> </Eq> Also look at the Biwug CAML Designer for all your CAML querying needs.


0

Try changing your <eq> </eq> tags to <Eq> </Eq> I think case matters for those tags.


0

Here's a script I've used that works for me in IE8. It works best in IE8 with jQuery version 1.8.2 in my case. $(".srch-Title3 a").click(function() { href = $(this).attr("href").toLowerCase(); if (href.indexOf(".pdf") !== -1) { window.open(href, "_blank"); return false; } });


1

Unfortunately the absolute URL isn't the best, but it's something :) You'll better need to have the site relative URL for the file, which you can pass then to GetFileByServerRelativeUrl available in Web object, using the correct Web where the file is. This method is available also in CSOM and REST API, so you can build and issue the REST query directly from ...


0

I did another search and found a question that was similar to mine labeled: Automatically add attachment to new list item After playing with the code, I was able to get mine working. First, create the function to get the current list and current item in order to find the attachment as the file object. The getUrlParameter("ID") is a short little function ...


0

You have to roll your own logic in that case, the default Save action saves and closes the form. So if you want some sort of tabbed interface that allows the user to "save" then finally "submit" you need to create functions that do the following: the Save button would create a list item if you are on tab 1 otherwise it is an update to the list item, Submit ...


2

By using the hints Anders provided and the reference here. I can make it work with below script. Simply put it into a Script Editor Webpart for the page you need it. <script language="javascript" type="text/javascript"> function DoSomethingWithRibbon() { // Gets a reference to a CUI.Ribbon object (CUI.js) var ribbon = ...


1

You could do it with javascript I guess, the name of View is Ribbon.Read, so this should work: SelectRibbonTab('Ribbon.Read', true);


0

This works for me, assuming the field is a single line of text: $("td.ms-vb2:contains('-')").css('background-color', 'red'); This works as well, but I believe the above is more efficient: $('td.ms-vb2').each(function(){if($(this).text().indexOf('-') >= 0) $(this).css('background-color', 'red')}); Office 365 assigns the ms-vb2 class to currency ...


0

Try this jQuery(document).ready(function(){ jQuery('td .ms-vb2').each(function() { var val = jQuery(this).html(); if(val != null && val != '') { if(val.indexOf("-") > -1) { jQuery(this).css("background-color","#FF0000"); } } }); });


0

try applying this $(document).ready(function(){ $("td .ms-vb2").each(function () { if($(this).val().indexof('-') > -1) { $(this).css("background-color", "#FF0000"); } }) });


1

Consolidate into one file. Advantages are big, and disadvantages don't really exist, as you have full control of the functions/variables (sure, you can make mistakes, but you can do that otherwise as well), and browsers cache the JS file, but remember to enable BlobCache.


1

Instead of separate file you can also use CSR/JSLink here. That way you can consolidate all the function for each of the form in one JavaScript file. You simply need to use JSLink option for those pages(Newform.aspx, DispForm.aspx and Editform.aspx). Here is the examples for JSLink(CSR): Client-side rendering (JS Link) code samples Using JSLink to ...


1

Your site is being loaded with securely https protocol and your font awesome file is being loaded using http protocol. That is why the browser is blocking the content loading of that font awesome file (It's the default behavior of browser). You need to always click on that alert button or else if possible download the font awesome file and place into ...


1

Hi i have just put up a fiddle for you,updated fiddle hope that helps SCRIPT $('#mycalendar').fullCalendar( { header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, dayClick: function( date, allDay, ...


2

The following selector worked for me: $('td.ms-vb-user a:contains(NOTAPPROVED)').closest('tr').css('background-color', '#f5a9a9'); User fields do not get the ms-vb2 class applied to them (at least not in my views in O365).


0

jQuery's :contains is case sensitive. If the value in the column is NOTAPPROVED then you need to do this: $Text = $("td.ms-cellstyle.ms-vb2:contains('NOTAPPROVED')");


0

As mentioned above the script you posted loads jquery to your page so you can use its function but, since you mentioned about freezing headers Check here to know how would you implement them, alternatively there is a script which makes this possible in easier way click here for more details


0

The added script tag is to load the JQuery plugin. After loading it you have to explicitly write your JQuery code to hide the elements, either by using class name or the control id. Example: The below code snippet will be executed after page load and hides a control. $( document ).ready(function() { $('#ControlID').hide() });


0

I found that If I place a tick in the 'Server Render' box within the Miscellaneous section of the web part properties, the issue was resolved. This disables client-side rendering for the Data View and in my case, fixed the issue of the JSLink not taking affect after paging.


0

If you are using SharePoint's OOB Date time control, I am assuming below would be the mark up. <SharePointWebControls:DateTimeControl ID = "StartDate" runat = "server"></SharePointWebControls:DateTimeControl> So now in order to validate this field we can use jQuery. 1. Understand how this SharePoint control is rendered in browser. It will be ...


0

I found the solution after lots of tries...to get the result use JavaScript "string contains" where you have to use "IndexOf" I just had to change my condition in if statement to if (empName.toUpperCase().indexOf(Name.toUpperCase()) > -1 && distDeput != DisDep) {


1

If you are using a radio button that means you will be able to select only one of them every time, so instead of looping them why dont you validate your condition when one of them is clicked? It would be easy and faster than looping and then checking any one of them e.g.: $(function(){ $("input[name='EventSet']").click(function(){ ...


2

Try this $(document).ready(function () { var curResType = $('input[title="ReservationType2"]').val(); $('input:radio[value="' + curResType + '"]').each(function () { $(this).prop('checked', true); }); }); Or you can altogether avoid looping $(document).ready(function () { var curResType = ...


0

It seems this issue is happening because you can using timeout for manipulating the DOM Elements. Try below $(document).ready(function(){ $('a[href*="DispForm.aspx"]').on("hover",function(){ alert('Mouse Hover'); }); });



Top 50 recent answers are included