I want to add new button to the ribbon in Pages library. To do so, I have following code:
<CustomAction Id="Ribbon.PublishTab.Publishing.Actions.UploadDocumentButton" Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.EditingTools.CPInsert.Links.Controls._children" >
<Button Id="Ribbon.PublishTab.Publishing.UploadDocumentButton1" Command="Test1"
Image16by16="/_layouts/15/Solution/Images/Al_16_by_16.jpg"
Image32by32="/_layouts/15/Solution/Images/Al_32_by_32.jpg"
LabelText="Upload File" TemplateAlias="o1" Sequence="100" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="Test1" CommandAction="javascript:function Action()
{
alert('hello');
}
Action();" EnabledScript="javascript:function JustReturnTrue(){ return true;}JustReturnTrue();" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
The ribbon button appears on proper place. But it is always disabled. After try things, I figured out that when I remove command
attribute from <Button>
tag it is getting enabled but when I place the same attribute and deploy, it is getting disabled.
What am I missing?
return true
statement inJustReturnTrue()
method.return true
(as per my updated question) but getting the same issue. @NadeemYousufEnabledScript
at all.