Today i am going to explain how to show loading/Progress image in SharePoint list new form when new item is added.
Please follow below steps.
Please follow below steps.
- First you need to download any animated .gif image named it as "Loading.gif". In this example i have used Site Asset library to store the image.
- Open the list in which you want to show this loading image and click on new item link.
- SharePoint list NewForm.aspx will open.
- Now edit the NewForm.aspx page.
- Add the content editor web-part above the existing web-part.
- Now add below script,css and image tag by edit the html in content editor web-part.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
<style type="text/css">
#imgLoading{display:none;}
</style>
<script type="text/javascript">function PreSaveItem()
{
$("#imgLoading").css("display", "block");
if ("function" == typeof (PreSaveAction)) {
return PreSaveAction();
}
return true;
}
</script>
<div style="padding-top: 10px; padding-left: 230px;">
<img width="100" height="100" id="imgLoading" src="/sites/samplesite/SiteAssets/Loading.gif" alt=""/>
</div>
7. Save the page.
{
$("#imgLoading").css("display", "block");
if ("function" == typeof (PreSaveAction)) {
return PreSaveAction();
}
return true;
}
</script>
<div style="padding-top: 10px; padding-left: 230px;">
<img width="100" height="100" id="imgLoading" src="/sites/samplesite/SiteAssets/Loading.gif" alt=""/>
</div>
7. Save the page.
9. Once you click on Save button it will showing process image as below.
- In this example we are catching the PreSaveItem() event of the SharePoint list using JavaScript and we have written the business logic in this event.
- This event is fired when we click on save button in SharePoint NewForm.aspx So the process image will be shown until the item is added to the SharePoint list.
Enjoy.....