Add prefix to the phone no column in SharePoint using JavaScript/JQuery

In this article we are able to see how to add prefix to the phone no in SharePoint list column using JavaScript.
enter only numbers in text box in SharePoint
Generate unique id in SharePoint using jQuery/JavaScript 
How to populate today’s date using JQuery in SharePoint
We are having a column with name Phone no, whenever we enter the number in that text box, once we click on save button, in the display form we can able to see the value like Call:987XXX3210.
We adding extent Call prefix before the Phoneno, we writing the code in PreSaveAction.

function PreSaveAction(){

try
{

var pno= document.querySelector('input[title^="Phoneno"]').value;
if(pno=="")
{

}
else
{
pno = pno.indexOf("Call:")==-1 ? 'Call:'+pno : pno;
$('input[title^="Phoneno"]').val(pno);
}
}
catch(e)
{
alert("error on save :"+e.message);

}
return true;
}


Reduce one day in SharePoint list Column using PowerShell

In this article we can able to see how to reduce one day less for a particular date column in SharePoint list using PowerShell.


Copy data from one list to another list in SharePoint using PowerShell
We migrated the content from lotus notes to SharePoint, due to some time Zone difference we got one last more for all the items in the list. For that using PowerShell we reduced the one day.
  
Add-PSSnapin microsoft.sharepoint.powershell
$spWeb = Get-SPWeb "http://dotnetsharepoint.com/sites/sharepoint"
write-host $spweb
$List=$spWeb.Lists["ListName"]

write-host $lList
$spItems = $List.GetItems()

foreach($spItem in $spItems)

{

    $datevalue = $spItem["DateColumnName"].AddDays(-1);

$spItem["DateColumnName"] = $datevalue
$modifiedBy = $spItem["Editor"]
$modifieddate = $spItem["Modified"]
$spItem["Editor"] = $modifiedBy
$spItem["Modified"] = $modifieddate
$spItem.Update()
$list.Update()
 }
SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Could not save the list changes to the server SharePoint designer 2013

In SharePoint Designer  2013 we are trying to create a custom new form, while we trying to create we are getting an error  “Could not save the list changes to the server”, we closed the designer and opened again even though we are getting the same issue.


We access the SharePoint site and navigated to the particular list setting there we are able to see the threshold limit is increased, we identified this may be the root cause so we ran a PowerShell script to bypass the threshold limit.

Check the below URL



Now we are able to create “New Form” in the Designer without any issues.

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Disable list throttling SharePoint using PowerShell

In some cases we have to handle large amount of list items with more than 50,000 items, instead of changing the threshold at farm level, we can bypass the limit at list level for that we can use PowerShell script.

$web give the sitecolection/site Url and $list give the list display name that you want to disable the limit.

For disabling we are $list.EnableThrottling = $false
If you want to enable it again we can change it to $list.EnableThrottling = $true


Add-PSSnapin Microsoft.SharePoint.PowerShell
$web = Get-SPWeb http://dotnetsharepoint.com/sites/sharepoint/
$list = $web.Lists["SharePointList"]
write-host $list
$list.EnableThrottling = $false
$list.Update()


SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Set cursor in textbox on button click in SharePoint using jQuery

In this article we are able to see how to move cursor in to textbox on button click.
We are having a textbox with title “Name” for that textbox and a button with value “Chose Name”
We are having so many fields in the New Form and Edit Form, we placed a button to move the cursor to particular column while clicking on the button.

<html>
<input  type='button' onclick='selectperson()'  value='Choose Name />
</html>

<script>
function selectperson ()
{
$('input[title^="Name"]').focus();
}
</script>

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Generate unique id in SharePoint using jQuery/JavaScript

In this article we are able to see how to generate unique id for each item, while creating an item, we are showing the Id in the NewForm.aspx
We are having text box with id “textbox1”, in the GenerateUniqueID method we are getting the Unique GUID as per our requirement we are adding the Prefix SP with six unique value with text and characters.

<html>
Unique ID:<input type="text" id="textbox1"/>
</html>

function GenerateUniqueID() {
uid = 'SP-' +'xxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16).toUpperCase();
});
}
<script>
GenerateUniqueID;
$('#textbox1').val(uid);

</script>

Output:



SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

How to populate today’s date using JQuery in SharePoint

How to populate today’s date using JQuery in SharePoint
In this article we are able to see how to get the todays date based on condition from another column when we click on save button using JQuery

We are having a requirement with Stats Column with drop down  option, if the status column is in Completed then when we click on the save button it will display the todays date on Date column filed.

function PreSaveAction()
{
if ($("select[Title='Status'] option:Selected").val() == 'Completed') {
var date = new Date();
var datinformat = date.getMonth()+1 + "/" + date.getDate() + "/" + date.getFullYear();
$("input[title = 'DateField']").val(datinformat);
}
else
{
$("input[title = 'DateField']").val("");

}

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

How to populate value from one field to another field in SharePoint Using JQuery

How to populate value from one field to another field in SharePoint Using JQuery
In this article we are able to show how to populate from one filed to another field based using JQuery in SharePoint.

We are having two filed one is Dropdown filed and another one is Singlelinetextfield , whenever the user select the value in the dropdown we have to populate the same vale in to the single line if text.
Below is the code snippet

<script type="text/javascript" src="http://dotnetsharepoint.com/sites/SP/SiteAssets/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="http://dotnetsharepoint.com/sites/SP/SiteAssets/jquery.SPServices-2014.01.min.js"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function()
{

$("select[title^='Dropdownfiled']").change(function() {
folderName=$("select[title^='Dropdownfiled'] option:selected").text();

$("input[title='singlelinetextfield']").val(folderName);
               
});

});


</script>
SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM