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>
-
its working for publish. I want to get it worked for Submit.Rajeev K– Rajeev K2016-01-18 11:34:45 +00:00Commented Jan 18, 2016 at 11:34
-
I edited my answer to add this case.Evariste– Evariste2016-01-18 11:44:35 +00:00Commented Jan 18, 2016 at 11:44
-
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 K– Rajeev K2016-01-24 07:28:08 +00:00Commented Jan 24, 2016 at 7:28
-
Poping-up the Schedule window is another story, not related to the
command handlersthing. Please, post a new question, and I'll try to find and answer it (add a comment here so I know).Evariste– Evariste2016-01-24 11:02:21 +00:00Commented Jan 24, 2016 at 11:02 -
Found it: to open the Schedule dialog, simply call
Pub.Ribbon.PubCommands.schedule();.Evariste– Evariste2016-01-28 17:51:03 +00:00Commented Jan 28, 2016 at 17:51
$("#customButtonID").click(function(){$("#ribbonButtonID").click()});