I wish to populate message on click of save button when we are uploading documents to document library.
I need to do something with editForm.aspx
page but I'm not able to reach there.
How can I do this using javascript?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityEdit your EditForm.aspx
and put the below code inside a Script editor web part.
My suggest is that you should put your code in text file & load it to Script Editor webpart
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript">
var j = jQuery.noConflict();
function PreSaveAction() {
var txtTitle = j(":input[title='Title']").val();
alert(txtTitle);
if(txtTitle == ''){
alert("Please enter a title");
return false;
}
else{
return true;
}
}
</script>
Note:- This is the sample code, If your title is blank and you click on the Save button then it will show the alert.
First, disable the form to open in pop up window. Next, Edit the page and add content editor web part to the page referring to a .txt or javascript file.
last step is to use form presave action method to add your javascript to show an alert message.
See here, how to use PreSaveAction: https://www.enjoysharepoint.com/create-sharepoint-sub-site-using-jquery-javascript-client-object-model-in-sharepoint-2016/