SharePoint: PreSaveItem() in NewForm.aspx list form

This SharePoint tutoria, we will discuss, how to use PreSaveItem() in SharePoint 2013 list forms like NewForm.aspx and EditForm.aspx. The same way we can use PreSaveItem() in SharePoint 2013/2016/Online list forms.

Previously we have discussed how to use PreSaveAction() in SharePoint 2013. This works almost in the same manner.

PreSaveItem() in SharePoint List Form

Here I am trying to do some validation check before submitting an item. In the NewForm.aspx or in the EditForm.aspx, you can put the below code inside a script editor webpart.

<script type="text/javascript">
var j = jQuery.noConflict();
function PreSaveItem() {
var txtTitle = j(":input[title='Title']").val();
alert(txtTitle);
if(txtTitle == "){
alert("Please enter a title");
return false;
}
else{
return true;
}
}
</script>

You may like following SharePoint tutorials:

Here, we learned how to use PreSaveItem() in SharePoint 2013 NewForm.aspx form. Same way, we can use PreSaveItem() in SharePoint 2013/2016/Online NewForm.aspx forms.

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

>