5

Looking for a very basic example of how to get the submit button at the top

enter image description here

But seem only able to do this

enter image description here

<apex:page docType="html-5.0" standardController="User_Story__c" showHeader="false" sidebar="false" standardStylesheets="false">

     <script type='text/javascript' src='/canvas/sdk/js/publisher.js'></script>
<script> 
    Sfdc.canvas.publisher.subscribe({name: "publisher.showPanel",
        onData:function(e) {
            Sfdc.canvas.publisher.publish({name:"publisher.setValidForSubmit", payload:"true"});
    }});
    Sfdc.canvas.publisher.subscribe({ name: "publisher.post",
        onData: function(e) {
            alert("call some remote action here");
            Sfdc.canvas.publisher.publish({ name: "publisher.close",
                payload:{ refresh:"true" }});
    }}); 
</script>

    <button class="primaryButton cuf-publisherShareButton default uiBlock uiButton" accesskey="" 
            disabled="disabled" type="button" data-aura-rendered-by="5:1853.28">Submit</button>

</apex:page>

Thanks

2 Answers 2

3

You won't be able to add HTML elements to the container for your Visualforce page as it comes from a different server to your page, and the browser will block any attempt to access the DOM. That, and the fact that the publisher only provides a hook to the submit button provided by Salesforce1, as opposed to allowing custom buttons to be created, suggests that what you are trying to do isn't possible at the moment. There aren't any ideas for this either, so it might make sense to raise one.

1
  • Sorry Keir I completely missed your response. Jun 6, 2014 at 21:55
0

I found what I was looking for finally... The documentation is very poor, I don't normally moan.

    <script type='text/javascript' src='/canvas/sdk/js/publisher.js'></script>
<script> 
    Sfdc.canvas.publisher.subscribe({name: "publisher.showPanel",
        onData:function(e) {
            Sfdc.canvas.publisher.publish({name:"publisher.setValidForSubmit", payload:"true"});
    }});
    Sfdc.canvas.publisher.subscribe({ name: "publisher.post",
        onData: function(e) {
            alert("call some remote action here");
            Sfdc.canvas.publisher.publish({ name: "publisher.close",
                payload:{ refresh:"true" }});
    }}); 
</script>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .