Skip to content

Instantly share code, notes, and snippets.

@radhack
Created April 28, 2017 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radhack/9b2d2486138af453424b3e7474810aa3 to your computer and use it in GitHub Desktop.
Save radhack/9b2d2486138af453424b3e7474810aa3 to your computer and use it in GitHub Desktop.
quick HelloSign script example
<script type="text/javascript">
HelloSign.init("<?php echo $client_id ?>");
HelloSign.open({
url: "<?php echo $sign_url ?>",
uxVersion: 2,
allowCancel: true,
skipDomainVerification: true,
debug: true,
messageListener: function (eventData) {
(console.log("Got message data: " + JSON.stringify(eventData)));
if (eventData.event == HelloSign.EVENT_SIGNED) {
HelloSign.close();
console.log(eventData.signature_id);
window.location = "index.php";
} else if (eventData.event == HelloSign.EVENT_CANCELED) {
HelloSign.close();
alert("Event Canceled And Stuff!");
console.log(eventData);
window.location = "index.php";
} else if (eventData.event == HelloSign.EVENT_ERROR) {
HelloSign.close();
alert("There Was An Error And Stuff!");
console.log(eventData);
window.location = "index.php";
} else if (eventData.event == HelloSign.EVENT_SENT) {
HelloSign.close();
alert("Signature Request Sent And Stuff!");
console.log(eventData);
window.location = "index.php";
} else if (eventData.event == HelloSign.EVENT_TEMPLATE_CREATED) {
HelloSign.close();
var template_id = eventData.template_id;
window.alert("Template ID is " + template_id);
console.log(eventData);
window.location = "index.php";
} else if (eventData.event == HelloSign.EVENT_DECLINED) {
HelloSign.close();
alert("Signature Request declined And Stuff!");
console.log(eventData);
window.location = "index.php";
}
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment