We had created a survey and wanted some message to appear when user clicks on finish button.
Through one of my colleague i came to know about this function — PreSaveAction
alert(“Thanks for the participating in the survey!”);
Placing the above function in the newform.aspx using SharePoint designer did the trick.
We could use the PreSaveAction function for custom validation as well !