1

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

1 Answer 1

3

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?

1
  • this was the mistake Location="CommandUI.Ribbon" thanks a lot for your help
    – fallout
    Mar 6, 2012 at 13:28

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.