Is it possible to add custom event handler to the submit button of Edit Form through CSR/JSLink?
If yes, any documentation/links or example that I could use to achieve this with pure CSR?
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 communityWell, you can't exactly use CSR itself to do that, because you can't hook into the rendering of the button.
What you need to do is create a custom PreSaveAction
function which will be called by SharePoint when the submit button is clicked.
You could potentially use something like OnPostRender
in the CSR framework to define the function or something, but that seems unnecessary.
You definitely can use the JSLink property of the edit form web part to pull in a custom script file in which you define your PreSaveAction
function:
You can learn a bit more about PreSaveAction
here and here, and of course you can just search for "SharePoint PreSaveAction" to find plenty more resources.
It might not be possible with JSLink. But, you can change the event handler of default save button as well as you can create a custom save button using JavaScript (in content editor or script editor web parts).
Check below references which might help you: