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.
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;
}
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;
}