1

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!

1
  • Thank you so much! It works :) Commented Jun 15, 2020 at 21:12

1 Answer 1

0

You need to open the form in edit mode. Then you can add a webpart. This is the url part you need to add to the url of your form: ?ControlMode=Edit&DisplayMode=Design

-> Complete example: (on my environment) http://site_url/subsite/Lists/listName/NewForm.aspx?ControlMode=Edit&DisplayMode=Design

-> another example: http://site_url/subsite/Lists/listName/DispForm.aspx?ID=1&ControlMode=Edit&DisplayMode=Design

Hope this helps

3
  • Most old SharePoint 2003 parameters also work: abstractspaces.wordpress.com/2008/05/05/… Commented Feb 20, 2017 at 14:16
  • I think you got my question wrong. I know how to add web parts to my New/Display/Edit forms, I want to add code to my task forms. Or can I type in the link to the library where the taskform is in? ... Commented Feb 20, 2017 at 16:21
  • Ok, I think I understand your question now. You have another form specific to tasks. It's not on any of my sites so I can't really help. Maybe SharePoint designer or add a custom action with a javascript link that loads on every page (with a bit of logic to detect when it is a taskform). Could also be its in the layouts folder. Commented Mar 8, 2017 at 13:10

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.