Domanda

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

È stato utile?

Soluzione

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?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top