Skip to content

Instantly share code, notes, and snippets.

@radhack
Last active November 7, 2018 16:28
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/78535a2bbe2ab586ea27901367f3d9ef to your computer and use it in GitHub Desktop.
Save radhack/78535a2bbe2ab586ea27901367f3d9ef to your computer and use it in GitHub Desktop.
HelloSign Embedded Feature Page Example
<script>
HelloSign.init("<?php echo $client_id ?>");
HelloSign.open({
url: "<?php echo $sign_url ?>",
allowCancel: true,
// skipDomainVerification: true,
uxVersion: 2,
debug: true,
// userCulture: HelloSign.CULTURES.ES_MX, // Spanish (Mexico)
// userCulture: HelloSign.CULTURES.ES_ES, // Spanish (Spain)
// userCulture: HelloSign.CULTURES.FR_FR, // French
// userCulture: HelloSign.CULTURES.SV_SE, // Swedish
// userCulture: HelloSign.CULTURES.DE_DE, // German
// userCulture: HelloSign.CULTURES.ZH_CN, // Chinese (Traditional) NOTE: THIS DOES NOT YET SUPPORT RIGHT TO LEFT; ONLY CHARACTERS
// userCulture: HelloSign.CULTURES.DA_DK, // Danish
// userCulture: HelloSign.CULTURES.NL_NL, // Dutch
// userCulture: HelloSign.CULTURES.PT_BR, // Portuguese (Brazil)
// userCulture: HelloSign.CULTURES.PL_PL, // Polish
messageListener: function (eventData) {
(console.log(">-*>-*>-*> Got message data: " + JSON.stringify(eventData)));
if (eventData.event == HelloSign.EVENT_SIGNED) {
if (eventData.signature_id == null) {
alert("SIGNATURE_ID MISSING");
}
HelloSign.close();
console.log(eventData.signature_id + " is the signature_id of the signer");
window.location = "/yourapppagehere.html";
} else if (eventData.event == HelloSign.EVENT_CANCELED) {
HelloSign.close();
console.log(eventData);
} else if (eventData.event == HelloSign.EVENT_ERROR) {
// HelloSign.close();
var error = eventData.description;
alert(error);
console.log(eventData);
} else if (eventData.event == HelloSign.EVENT_SENT) {
if (eventData.signature_request_id == null) {
alert("SIGNATURE_REQUEST_ID MISSING");
}
HelloSign.close();
console.log(eventData);
console.log("************");
console.log(eventData.signature_request_id);
} 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);
} else if (eventData.event == HelloSign.EVENT_DECLINED) {
HelloSign.close();
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