2

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?

0

Well, 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:

screen shot of JSLink in edit form web part

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.

1
  • Yes, you are right, Dylan. I didn't know that CSR is available for the list forms! – Denis Molodtsov Apr 28 at 18:52
0

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:

  1. Custom Save Button On Custom SharePoint List Forms
  2. Create Custom Save and Redirect Button On A SharePoint Form
  3. SharePoint 2013 - Custom save button - Handling click using JavaScript
  4. How to trigger the click event of the SharePoint OOTB list's new form Save button?
2
  • Also, there might be other easier solutions based on what you are going to achieve with custom event handler. I will be able to suggest if you can add more details to your question. – Ganesh Sanap Apr 28 at 16:50
  • Hi @David, does this answers your question? If yes, please Upvote(^) and accept as an Answer as it helped you & it will help others with similar question in future to find the correct answer easily. – Ganesh Sanap May 18 at 4:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.