I have one HTML button to to submit on one custom page layout. I want to to submit or publish this page on this HTML button click. I tried with binding it with ribbon button onclick using jquery. But its not working. Anybody has any idea how to achieve this?
1 Answer
Check https://sharepoint.stackexchange.com/a/52877/35604:
<script type="text/javascript">
function Custom_Submit(command)
{
SP.Ribbon.PageState.Handlers.showStateChangeDialog(command, SP.Ribbon.PageState.ImportedNativeData.CommandHandlers[command]);
}
</script>
<input type="button" onclick="javascript:Custom_Submit('PageStateGroupPublish'); return false;" value="Publish" id="btnPublish"></input>
And quite the same for "Submit for approval" action, only change PageStateGroupPublish
to PageStateGroupSubmitForApproval
:
<script type="text/javascript">
function Custom_Submit(command)
{
SP.Ribbon.PageState.Handlers.showStateChangeDialog(command, SP.Ribbon.PageState.ImportedNativeData.CommandHandlers[command]);
}
</script>
<input type="button" onclick="javascript:Custom_Submit('PageStateGroupSubmitForApproval'); return false;" value="Submit" id="btnSubmit"></input>
-
-
-
Do you have any idea about command ID for schedule button on the ribbon ? I checked that namespace but looks like its not listed there..! Please let me know if you have any idea about it. I have to have one custom button to schedule publication start date.!– Rajeev KJan 24, 2016 at 7:28
-
Poping-up the Schedule window is another story, not related to the
command handlers
thing. Please, post a new question, and I'll try to find and answer it (add a comment here so I know).– EvaristeJan 24, 2016 at 11:02 -
Found it: to open the Schedule dialog, simply call
Pub.Ribbon.PubCommands.schedule();
.– EvaristeJan 28, 2016 at 17:51
$("#customButtonID").click(function(){$("#ribbonButtonID").click()});