Question

Reference a .js file on a spribbon custom action elements.xml

on my javascriptmethods.js file:

function test(){
  alert('test message.');}

on my custom action elements.xml:

<CustomAction
    Location="CommandUI.Ribbon"
    ScriptSrc="/_layouts/.../javascriptmethods.js" Sequence="100">


<CommandUIHandlers>
   <CommandUIHandler Command="MyCommands.Alert"
   CommandAction="javascript:test();" />
</CommandUIHandlers>

not working, what's missing?

spregards

Était-ce utile?

La solution

Everything works fine, I've even created a test project for you: http://www.4shared.com/zip/EwqRtH6c/ScriptLinkTest.html. Look at it. Did you check your js file is loaded correctly on the page?

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top