Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In sharepoint 2010, I want to add javascript to the alerts popup window page, but I don't want to modify the actual layouts file. I want to dynamically insert javascript in it. Basically the button to open the window is through a sharepoint function called NewItem2. I need a reference to that window if I want to add a script tag to it. I was thinking of modifying the function so that it returns the id to the window. However I cannot find where the function is.

Can anyone help please? Thanks

share|improve this question
add comment

2 Answers

If I'm not wrong you can find this function into C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS{LCID} folder. There is the init.js and init.debug.js. Of course, you will have these files for each language that is installed to your environment.

But I do not recommend you to make changes in these files, because these files are used for all web applications, and can be overridden by SharePoint upgrade.

You can try to use solution like this.

share|improve this answer
add comment

It is not good practice for many reasons to modify out-of-the-box SharePoint files, the most obvious being that this type of customization is officially unsupported. For details please follow, for example this article.

In your scenario there are at least 2 ways how to provide additional client side functionality for Alert dialog:

  • Override NewItem2 function (details) But in that approach the SharePoint out-of-the-box javascript files are not being modified. The example of usage of this technique in SharePoint could be found here
  • Inject custom functionality (server and client side) via Delegate Control. More details about customizing Alert dialog using this technique could be found here
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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