so I tried to add a little horizontal menu to a wiki-site and wanted one of the links to open in a modal Dialog (a contact form). Every time I try to add it about the UI, sharepoint removes the link. Same in SP Designer.

Here's the syntax I'm using:

<a onclick="javascript:SP.UI.ModalDialog.ShowPopupDialog('url/contactform.aspx');">Contact Form</a>

I don't have a clue why it's not working, it's the same syntax I'm using for one of my webpart-buttons and it works like a charm there, would be great to have some ideas on this :)

update: I tried it with href attribute, too. same behaviour, sp removes the attribute :(

3 Answers 3


In Wiki pages SharePoint will always remove scripts, or calls to javascript. One way to overcome is to use jQuery :live functions in a function in a separate .js file stored somewhere in a Document library and added in page via a CEWP, but then add an ID to your Link item.

Yes, it sounds like overkill, but that would be one way to do it.


I suppose, SharePoint checks the validity of the link and removes it. It doesn't check the validity in custom webparts. You could try to repclace onclick with href attribute. Hope it helps. Say if it doesn't.

<a href="javascript:SP.UI.ModalDialog.ShowPopupDialog('url/contactform.aspx');">
Contact Form</a>
  • sry, will update my question. I tried that, too. Same behaviour :(
    – Dominik
    Feb 8, 2013 at 13:19

The first hint from Anatoly was the key for me. Sadly it took 3 hours to find out.

Just insert a new Content editor webpart and insert the code their. When you change the appearance and hide the frame it looks like it is directly inserted on the wiki site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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