We have a requirement where the customer can sign and fill the form and submit.After submitting the form the form will be saved as a attachment and the form will be emailed to the Owner of the Account as a PDF. I have achieved all the above process. But I need two command buttons to achieve the whole process. In this case customer might get confused or there is a chance for their to miss any of the button , So I have an idea to avoid this, When the customer enter into the form they can see only one button called "Submit" after clicking the submit button the page should be reloaded with the other button called "Please Review and Confirm" then the submit button should be hidden. Then the user needs to click the button to complete the form. So can anyone please guide me on how to achieve this?
[SalesForce] How to hide the button when clicking other button using VF page
Related Solutions
You can't customise the buttons on the approval related list like you can for the others.
Aside from Visualforce, you might want to take a look at this post from Jason Venable (aka TehNrd) regarding showing/hiding buttons through javascript:
http://www.tehnrd.com/show-and-hide-buttons-on-page-layouts/
You could then have a roll up summary field on your master record that shows the number of child records that have not been submitted for approval, and your javascript can interrogate that value and hide the button accordingly.
There is an element of fragility about this, as you'd be relying on accessing fields/buttons by names that could conceivably change under you.
Another way to approach it may be to have the approval process entry criteria take into account the rollup summary field of child records not submitted for approval. While that wouldn't stop the button being displayed, it would stop the record entering the approval process.
There is already a nice blogpost on how to do this
http://corycowgill.blogspot.in/2013/12/capturing-signatures-with-html5-canvas.html
global with sharing class AnyObjectSignatureController {
public AnyObjectSignatureController(){
}
@RemoteAction
global static String saveSignature(String signatureBody, String parentId) {
try{
system.debug('Record Id == ' + parentId);
system.debug(signatureBody);
Attachment a = new Attachment();
a.ParentId = parentId;
a.ContentType = 'image/png';
a.Name = 'Signature Capture.png';
insert a;
return '{success:true, attachId:' + a.Id + '}';
}catch(Exception e){
return JSON.serialize(e);
}
return null;
}
}
Script
canvas = document.getElementById("signatureCanvas");
context = canvas.getContext("2d");
drawingUtil = new DrawingUtil(canvas);
function saveSignature(){
var strDataURI = canvas.toDataURL();
// alert(strDataURI);
strDataURI = strDataURI.replace(/^data:image\/(png|jpg);base64,/, "");
//alert(strDataURI);
AnyObjectSignatureController.saveSignature(strDataURI,accountId,processResult);
}
Visualforce Page
<canvas id="signatureCanvas" height="200px" width="300px"/>
<input id="saveSigButton" type="button" name="SigCap" onclick="saveSignature();" value="Capture Signature"></input>
Best Answer
These Help Your Scenario Visualforce page:
Apex Controller: