Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Tuesday, February 23, 2016

Uncaught TypeError: func is not a function in init.debug.js

Dear All,

I was facing "Uncaught TypeError: func is not a function" issue when browsing my SharePoint 2010 

site and due to this all the functions in my ribbon was not working.

Whenever I am clicking on ribbon items it always show me loading as shown below  


After digging more in to the issue I found that, in my Javascript code I have written 

ExecuteDelayUntilScriptLoaded(init(),"sp.js")

In the above syntax the '()' after init method was creating the problem.

I replace above syntax with 

ExecuteDelayUntilScriptLoaded(init,"sp.js")

and ribbon start working as expected.

Hope this post will save your time.

Thanks,
Sachin K.



Monday, November 16, 2015

Search Sort and Pagination in ng-repeat – AngularJS

Dear All,

Please find below link which explain a simple way to implement sorting, filtering and paging using angular js on your collection object.

Search Sort and Pagination in ng-repeat – AngularJS

Hope this information will save your time.

Thanks,
Sachin K. 

Friday, January 3, 2014

SharePoint Javascript get current user security group

Hi All,

Please find below sample script to get SharePoint security group name of current logged in user























Thanks,
Sachin K.

Tuesday, September 24, 2013

Get first day of previous month on JavaScript

Hi All,

Please find below javascript code to get the first day of the previous month

var ourDate = new Date();
//roll it back to the last day of last month
ourDate.setDate(-1);
//now that we’re in the proper month, let’s go back to the first day…
ourDate.setDate(0);
// and now we have it
alert(ourDate);


Thanks,

Sachin K.

Monday, February 18, 2013

Learning JavaScript Design Patterns

Hi All,

Excellent article on Learning JavaScript Design Patterns.

Thanks Addy Osmani for this wonderful article.

Thanks,
Sachin Katkar.

Tuesday, February 5, 2013

Hide fields from SharePoint NewForm, DispForm and EditForm pages


Hi All,

Please find below Jquery script to hide the fields from NewForm.aspx, DispForm.aspx and EditForm.aspx page of SharePoint list

Hide fields from EditForm and NewForm


<pre class="brush: js">

$(document).ready(function() { 
$('nobr:contains("Recurrence")').closest('tr').hide(); 
$('nobr:contains("Location")').closest('tr').hide();
}); 


</pre>


Hide Fields from DispForm page

<pre class="brush: js">


$(document).ready(function() {

// Method #1: Access by FieldName – All fields have unique FieldNames
$('td.ms-formlabel:contains("Location")').parent().hide();

// Method #2:  Access by ID – NOTE: Not all fields have unique IDs
$('tr:has(td[id=SPFieldRecurrence])').not('tr:has(tr)').hide();
});

</pre>


Please refer to the link for more detail information.

Thanks,

Sachin K.

Thursday, January 10, 2013

Using Javascript to get all choice values from SharePoint Choice column

Hi all,

Get List of all choice option from SharePoint Choice field with help of Javascript Client Object model




var context = new SP.ClientContext.get_current();

var web = context.get_web();

context.load();

var studList = web.get_lists().getByTitle("students");

var studbatches = context.castTo(studList.get_fields().getByInternalNameOrTitle("batches"), SP.FieldChoice);



context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod),

Function.createDelegate(this, this.onFailureMethod));



function onSuccessMethod(sender, args) {

var choices = studbatches.get_choices();

alert("Choices: (" + choices.length + ") - " + choices.join(", "));

}



function onFailureMethod(sender, args) {

alert("Error...!");

  } 


  Thanks,

 Sachin K. 


 Reference

Friday, December 14, 2012

Extracts the host web URL from the query string

Hi All,
Refer to the javascript code below to get the host web url from Query String in SharePoint 2013.

















Thanks,

Sachin K.

Tuesday, December 4, 2012

Getting Started with JSRender

Hello All,

If you are new to the JSRender and want to know more about how to render UI using JSRender technique refere to the liks below.

Using JsRender with JavaScript and HTML

Advanced JsRender Templating Features

These are some good links to get started with JSRender.

Thanks,
Sachin K.

Tuesday, November 27, 2012

Advance paging in SharePoint using Client Object Model and jQuery

Hi All,

Refer to this Link to see how to create custom paging by using SharePoint Client Object Model and Jquery without need to navigate between pages.


New idea,new Approach.   Thanks,   Sachin K.  

Monday, November 26, 2012

Get Client ID

Hi All,

Please find below simple javascript function to get client Id render by server control in html page via javascript.

function GetClientID(id, context) {


var el = $("#" + id, context);

if (el.length < 1)

el = $("[id$=_" + id + "]", context);

return el;

}

  var ctrlOk = GetClientID("btnOk").attr("id");

Where "btnOk" is the Id of your server control.

Thanks,
Sachin K.

Tuesday, July 24, 2012

Create, Read and Erase cookies in javascript

If you are looking for creating cooking in javascript here is the article on the same which explain you how to create, Read and then Erase cookies in javascript. Click Here to see the article.

Sunday, August 7, 2011

Mask SharePoint Title field to password field


To mask SharePoint Title field with password field Add CEWP on your list new item page and add following script in to it 
var inpColl=document.getElementsByTagName("input");
var globalvariable;
if(inpColl!=null && inpColl.length>0){

for (var i=0;i<=inpColl.length;i++)
{

   if(inpColl[i].title=="Title")
 {
  globalvariable=inpColl[i].id;
  var input=document.getElementById(globalvariable);
  var input2= input.cloneNode(false);
  input2.type="password";
  input.parentNode.replaceChild(input2,input);
  }

 }
}