Skip to content

Commit 20662ae

Browse files
document extension validation & recipient fixes
1 parent faad273 commit 20662ae

File tree

3 files changed

+194
-169
lines changed

3 files changed

+194
-169
lines changed

lib/workspaces/examples/sendEnvelopeWithRecipientInfo.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ const sendEnvelope = async (args) => {
4444
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
4545
const envelopesApi = new docusign.EnvelopesApi(dsApiClient);
4646

47-
const envelopeDefinition = makeEnvelope(args);
47+
const envelope = makeEnvelope(args);
4848

4949
//ds-snippet-start:Workspaces3Step6
50-
return await envelopesApi.update(args.accountId, args.envelopeId, { envelopeDefinition });
50+
return await envelopesApi.update(args.accountId, args.envelopeId, { envelope });
5151
//ds-snippet-end:Workspaces3Step6
5252
};
5353

@@ -67,7 +67,7 @@ const makeEnvelope = (args) => {
6767
});
6868

6969
const tabs = docusign.Tabs.constructFromObject({
70-
signHere: [signHereTab]
70+
signHereTabs: [signHereTab]
7171
});
7272

7373
const signer = docusign.Signer.constructFromObject({

public/assets/css.css

Lines changed: 169 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -1,165 +1,169 @@
1-
body {
2-
padding-top: 5rem;
3-
}
4-
5-
.split {-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;overflow-y: auto;overflow-x: hidden;}
6-
.gutter {background-color: transparent;background-repeat: no-repeat;background-position: 50%;}
7-
.gutter.gutter-horizontal {cursor: col-resize;background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg=='); }
8-
.gutter.gutter-vertical {cursor: row-resize;background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFAQMAAABo7865AAAABlBMVEVHcEzMzMzyAv2sAAAAAXRSTlMAQObYZgAAABBJREFUeF5jOAMEEAIEEFwAn3kMwcB6I2AAAAAASUVORK5CYII='); }
9-
.split.split-horizontal, .gutter.gutter-horizontal { height: 100%;float: left;}
10-
.colDivider {height: 50rem;}
11-
.gutter.gutter-horizontal {background-repeat: space}
12-
.preWrap, .preWrap code {white-space:pre-wrap; overflow-wrap: break-word; word-break: break-word }
13-
14-
15-
/* See https://css-tricks.com/hash-tag-links-padding/ */
16-
#index-page h4 {
17-
z-index: -100;
18-
}
19-
#index-page h4::before {
20-
z-index: -100;
21-
display: block;
22-
content: " ";
23-
margin-top: -4rem;
24-
height: 4rem;
25-
visibility: hidden;
26-
pointer-events: none;
27-
}
28-
29-
.btn-docu {
30-
31-
background-color: #00BAA1;
32-
color:#FFF;
33-
border-color: #121517;
34-
}
35-
36-
.btn-docu:hover, .btn-docu:focus, .btn-docu:active, .btn-docu.active, .open .dropdown-toggle.btn-docu {
37-
background-color: #02d6ba;
38-
color:#FFF;
39-
border-color: #050607;
40-
}
41-
42-
43-
.jumbotron {
44-
45-
background: #000 !important;
46-
padding-top: 0 !important;
47-
padding-bottom: 0 !important;
48-
padding-left: 30px !important;
49-
padding-right: 30px !important;
50-
margin: 0 !important;
51-
color: white;
52-
53-
54-
}
55-
56-
.jumbotron p {
57-
font-size: 1.45em;
58-
}
59-
60-
hr.styled {
61-
overflow: visible; /* For IE */
62-
padding: 0;
63-
border: none;
64-
border-top: medium double 0;
65-
color: #000;
66-
text-align: center;
67-
}
68-
hr.styled:after {
69-
content: "§";
70-
display: inline-block;
71-
position: relative;
72-
top: -0.7em;
73-
font-size: 1.5em;
74-
padding: 0 0.25em;
75-
background: white;
76-
}
77-
78-
.feedback, .hidden {display: none;}
79-
span.feedback {margin-left:2em;}
80-
81-
form.eg {max-width: 30em;}
82-
form.eg label {font-weight: 550;}
83-
84-
pre.json-display {
85-
background-color: ghostwhite;
86-
border: 1px solid silver;
87-
padding: 10px 20px;
88-
}
89-
.json-key {
90-
color: brown;
91-
}
92-
.json-value {
93-
color: navy;
94-
}
95-
.json-string {
96-
color: olive;
97-
}
98-
99-
/********************************************************************/
100-
/* index page tabs */
101-
#index-page a.nav-link {
102-
background: #007bff;
103-
color: white;
104-
margin-right: 3em;
105-
opacity: .60;
106-
}
107-
108-
#index-page a.nav-link.active {
109-
opacity: unset;
110-
}
111-
112-
113-
/* From http://tobiasahlin.com/spinkit/ */
114-
.spinner {
115-
margin: 100px auto;
116-
width: 150px;
117-
height: 140px;
118-
text-align: center;
119-
font-size: 10px;
120-
}
121-
122-
.spinner > div {
123-
background-color: blueviolet;
124-
height: 100%;
125-
width: 6px;
126-
display: inline-block;
127-
128-
-webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
129-
animation: sk-stretchdelay 1.2s infinite ease-in-out;
130-
}
131-
132-
.spinner .rect2 {
133-
-webkit-animation-delay: -1.1s;
134-
animation-delay: -1.1s;
135-
}
136-
137-
.spinner .rect3 {
138-
-webkit-animation-delay: -1.0s;
139-
animation-delay: -1.0s;
140-
}
141-
142-
.spinner .rect4 {
143-
-webkit-animation-delay: -0.9s;
144-
animation-delay: -0.9s;
145-
}
146-
147-
.spinner .rect5 {
148-
-webkit-animation-delay: -0.8s;
149-
animation-delay: -0.8s;
150-
}
151-
152-
@-webkit-keyframes sk-stretchdelay {
153-
0%, 40%, 100% { -webkit-transform: scaleY(0.4) }
154-
20% { -webkit-transform: scaleY(1.0) }
155-
}
156-
157-
@keyframes sk-stretchdelay {
158-
0%, 40%, 100% {
159-
transform: scaleY(0.4);
160-
-webkit-transform: scaleY(0.4);
161-
} 20% {
162-
transform: scaleY(1.0);
163-
-webkit-transform: scaleY(1.0);
164-
}
165-
}
1+
body {
2+
padding-top: 5rem;
3+
}
4+
5+
.split {-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;overflow-y: auto;overflow-x: hidden;}
6+
.gutter {background-color: transparent;background-repeat: no-repeat;background-position: 50%;}
7+
.gutter.gutter-horizontal {cursor: col-resize;background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg=='); }
8+
.gutter.gutter-vertical {cursor: row-resize;background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFAQMAAABo7865AAAABlBMVEVHcEzMzMzyAv2sAAAAAXRSTlMAQObYZgAAABBJREFUeF5jOAMEEAIEEFwAn3kMwcB6I2AAAAAASUVORK5CYII='); }
9+
.split.split-horizontal, .gutter.gutter-horizontal { height: 100%;float: left;}
10+
.colDivider {height: 50rem;}
11+
.gutter.gutter-horizontal {background-repeat: space}
12+
.preWrap, .preWrap code {white-space:pre-wrap; overflow-wrap: break-word; word-break: break-word }
13+
14+
15+
/* See https://css-tricks.com/hash-tag-links-padding/ */
16+
#index-page h4 {
17+
z-index: -100;
18+
}
19+
#index-page h4::before {
20+
z-index: -100;
21+
display: block;
22+
content: " ";
23+
margin-top: -4rem;
24+
height: 4rem;
25+
visibility: hidden;
26+
pointer-events: none;
27+
}
28+
29+
.btn-docu {
30+
31+
background-color: #00BAA1;
32+
color:#FFF;
33+
border-color: #121517;
34+
}
35+
36+
.btn-docu:hover, .btn-docu:focus, .btn-docu:active, .btn-docu.active, .open .dropdown-toggle.btn-docu {
37+
background-color: #02d6ba;
38+
color:#FFF;
39+
border-color: #050607;
40+
}
41+
42+
43+
.jumbotron {
44+
45+
background: #000 !important;
46+
padding-top: 0 !important;
47+
padding-bottom: 0 !important;
48+
padding-left: 30px !important;
49+
padding-right: 30px !important;
50+
margin: 0 !important;
51+
color: white;
52+
53+
54+
}
55+
56+
.jumbotron p {
57+
font-size: 1.45em;
58+
}
59+
60+
hr.styled {
61+
overflow: visible; /* For IE */
62+
padding: 0;
63+
border: none;
64+
border-top: medium double 0;
65+
color: #000;
66+
text-align: center;
67+
}
68+
hr.styled:after {
69+
content: "§";
70+
display: inline-block;
71+
position: relative;
72+
top: -0.7em;
73+
font-size: 1.5em;
74+
padding: 0 0.25em;
75+
background: white;
76+
}
77+
78+
.feedback, .hidden {display: none;}
79+
span.feedback {margin-left:2em;}
80+
81+
form.eg {max-width: 30em;}
82+
form.eg label {font-weight: 550;}
83+
84+
pre.json-display {
85+
background-color: ghostwhite;
86+
border: 1px solid silver;
87+
padding: 10px 20px;
88+
}
89+
.json-key {
90+
color: brown;
91+
}
92+
.json-value {
93+
color: navy;
94+
}
95+
.json-string {
96+
color: olive;
97+
}
98+
99+
/********************************************************************/
100+
/* index page tabs */
101+
#index-page a.nav-link {
102+
background: #007bff;
103+
color: white;
104+
margin-right: 3em;
105+
opacity: .60;
106+
}
107+
108+
#index-page a.nav-link.active {
109+
opacity: unset;
110+
}
111+
112+
form .form-group #error {
113+
color: red !important;
114+
}
115+
116+
117+
/* From http://tobiasahlin.com/spinkit/ */
118+
.spinner {
119+
margin: 100px auto;
120+
width: 150px;
121+
height: 140px;
122+
text-align: center;
123+
font-size: 10px;
124+
}
125+
126+
.spinner > div {
127+
background-color: blueviolet;
128+
height: 100%;
129+
width: 6px;
130+
display: inline-block;
131+
132+
-webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
133+
animation: sk-stretchdelay 1.2s infinite ease-in-out;
134+
}
135+
136+
.spinner .rect2 {
137+
-webkit-animation-delay: -1.1s;
138+
animation-delay: -1.1s;
139+
}
140+
141+
.spinner .rect3 {
142+
-webkit-animation-delay: -1.0s;
143+
animation-delay: -1.0s;
144+
}
145+
146+
.spinner .rect4 {
147+
-webkit-animation-delay: -0.9s;
148+
animation-delay: -0.9s;
149+
}
150+
151+
.spinner .rect5 {
152+
-webkit-animation-delay: -0.8s;
153+
animation-delay: -0.8s;
154+
}
155+
156+
@-webkit-keyframes sk-stretchdelay {
157+
0%, 40%, 100% { -webkit-transform: scaleY(0.4) }
158+
20% { -webkit-transform: scaleY(1.0) }
159+
}
160+
161+
@keyframes sk-stretchdelay {
162+
0%, 40%, 100% {
163+
transform: scaleY(0.4);
164+
-webkit-transform: scaleY(0.4);
165+
} 20% {
166+
transform: scaleY(1.0);
167+
-webkit-transform: scaleY(1.0);
168+
}
169+
}

views/pages/workspaces-examples/eg002AddDocumentToWorkspace.ejs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,34 @@
1616
1717
<div class="form-group">
1818
<label for="documentPath"><%= example.Forms[0].Inputs[1].InputName %></label>
19-
<input type="file" class="form-control" id="documentPath" placeholder="<%= example.Forms[0].Inputs[1].InputPlaceholder %>"
19+
<input type="file" accept=".pdf" class="form-control" id="documentPath" placeholder="<%= example.Forms[0].Inputs[1].InputPlaceholder %>"
2020
name="documentPath" required>
21+
<small id="error" class="form-text text-muted"></small>
2122
</div>
2223
2324
<input type="hidden" name="_csrf" value="<%- csrfToken %>">
2425
<%- include("../../partials/submitButton") %>
2526
</form>
27+
28+
<script>
29+
const fileInput = document.getElementById('documentPath');
30+
const errorEl = document.getElementById('error');
31+
32+
fileInput.addEventListener('change', (e) => {
33+
const file = fileInput.files[0];
34+
35+
// Check extension
36+
const isPdf = file.name.toLowerCase().endsWith('.pdf');
37+
const isPdfMime = file.type === 'application/pdf';
38+
39+
if (!isPdf || !isPdfMime) {
40+
fileInput.value = ''; // reset file input
41+
errorEl.textContent = 'Invalid file type. Please upload a PDF file.';
42+
} else {
43+
errorEl.textContent = ''; // clear any previous errors
44+
}
45+
});
46+
</script>
2647
<% } else { %>
2748
<%- formatString(example.RedirectsToOtherCodeExamples[0].RedirectText, formatString('href="work00{0}"', example.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo)) %>
2849
<form class="eg" action="work001" method="get">

0 commit comments

Comments
 (0)