Submit button in Salesforce1 visualforce page

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

Answer

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.

Attribution
Source : Link , Question Author : Michael Gill , Answer Author : Bob Buzzard

Leave a Comment