How to add code to a task form?

  • 20 February 2017
  • 2 replies
  • 6 views

Badge +7

What I want to achieve: - users always forget to click the OK Button after reading a task - I want a message when someone closes the task tab like 'You closed this tab without closing the task. To close your task go to the ... and click the 'OK'-Button underneath the task description.

At first I tried the code at List -> form web parts -> default new form -> add web part: script editor

<body onunload="stop()">  <script type="text/javascript" language="JavaScript"> <!-- function stop() {   alert("Message from ...: You closed this tab without closing the task. To close your task go ... click the 'OK'-Button underneath the task description."); } //     --> </script>

and this worked. Now I want the same to happen with my task form. I use the default sharepoint form (no InfoPath, no nintex forms).

Any ideas where I can type in the code? Thanks!


2 replies

Userlevel 3
Badge +9

thzu thzu‌, this would probably be a better question for the  space.  I can move this to that space if you'd like. 

Badge +7

yes, sure. thanks!

Reply