Skip to content

Commit 8dfde83

Browse files
committed
Updating responsiveSigning.js with a new Formula Tab
1 parent 3533f6c commit 8dfde83

File tree

4 files changed

+2745
-23
lines changed

4 files changed

+2745
-23
lines changed

lib/eSignature/examples/responsiveSigning.js

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,63 @@ function makeEnvelope(args) {
9494
routingOrder: "2",
9595
recipientId: "2",
9696
});
97+
98+
// add formula tabs
99+
const price1 = 5;
100+
const formulaTab1 = docusign.FormulaTab.constructFromObject({
101+
font: "helvetica",
102+
fontSize: "size11",
103+
fontColor: "black",
104+
anchorString: "/l1e/",
105+
anchorYOffset: "-8",
106+
anchorUnits: "pixels",
107+
anchorXOffset: "105",
108+
tabLabel: "l1e",
109+
formula: `[l1q] * ${price1}`,
110+
roundDecimalPlaces: "0",
111+
required: "true",
112+
locked: "true",
113+
disableAutoSize: "false",
114+
});
115+
116+
const price2 = 150;
117+
const formulaTab2 = docusign.FormulaTab.constructFromObject({
118+
font: "helvetica",
119+
fontSize: "size11",
120+
fontColor: "black",
121+
anchorString: "/l2e/",
122+
anchorYOffset: "-8",
123+
anchorUnits: "pixels",
124+
anchorXOffset: "105",
125+
tabLabel: "l2e",
126+
formula: `[l2q] * ${price2}`,
127+
roundDecimalPlaces: "0",
128+
required: "true",
129+
locked: "true",
130+
disableAutoSize: "false",
131+
});
132+
133+
const formulaTab3 = docusign.FormulaTab.constructFromObject({
134+
font: "helvetica",
135+
fontSize: "size11",
136+
fontColor: "black",
137+
anchorString: "/l3t/",
138+
anchorYOffset: "-8",
139+
anchorUnits: "pixels",
140+
anchorXOffset: "105",
141+
tabLabel: "l3t",
142+
formula: `[l1e] + [l2e]`,
143+
roundDecimalPlaces: "0",
144+
required: "true",
145+
locked: "true",
146+
disableAutoSize: "false",
147+
bold: "true",
148+
});
149+
150+
const signerTabs = docusign.Tabs.constructFromObject({
151+
formulaTabs: [formulaTab1, formulaTab2, formulaTab3]
152+
});
153+
signer.tabs = signerTabs;
97154

98155
// Add the recipients to the envelope object
99156
let recipients = docusign.Recipients.constructFromObject({
@@ -102,7 +159,6 @@ function makeEnvelope(args) {
102159
});
103160

104161
// add the document
105-
106162
let htmlDefinition = new docusign.DocumentHtmlDefinition();
107163
htmlDefinition.source = getHTMLDocument(args);
108164

@@ -146,8 +202,8 @@ function getHTMLDocument(args) {
146202
.replace("{ccName}", args.ccName)
147203
.replace("{ccEmail}", args.ccEmail)
148204
.replace("/sn1/", "<ds-signature data-ds-role=\"Signer\"/>")
149-
.replace("/l1q/", "<input data-ds-type=\"number\"/>")
150-
.replace("/l2q/", "<input data-ds-type=\"number\"/>");
205+
.replace("/l1q/", "<input data-ds-type=\"number\" name=\"l1q\"/>")
206+
.replace("/l2q/", "<input data-ds-type=\"number\" name=\"l2q\"/>");
151207
}
152208

153209
function makeRecipientViewRequest(args) {

0 commit comments

Comments
 (0)