-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
184 lines (167 loc) · 7.61 KB
/
Copy pathindex.html
File metadata and controls
184 lines (167 loc) · 7.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DocuSign Pre-requisite Form</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 18px;
}
.field-group {
margin-bottom: 15px;
}
.field-group label {
display: block;
margin-bottom: 5px;
}
.dynamic-fields {
margin-bottom: 15px;
}
#confirmationPage {
display: none;
}
</style>
</head>
<body>
<h1>DocuSign Pre-requisite Form</h1>
<form id="dynamicForm">
<!-- Title -->
<div class="field-group">
<label for="title">Document Title</label>
<input type="text" id="title" name="title" required>
</div>
<!-- Department -->
<div class="field-group">
<label for="department">Department</label>
<select id="department" name="department" required>
<option value="" disabled selected>Select Department</option>
<option value="Legal">Legal</option>
<option value="HR">HR</option>
<option value="IT">IT</option>
</select>
</div>
<!-- External Contacts -->
<div class="field-group">
<label>External Email and Contact Numbers</label>
<div id="externalContacts" class="dynamic-fields">
<div class="external-contact">
<input type="email" name="externalEmail[]" placeholder="External Email" required>
<input type="text" name="externalContact[]" placeholder="External Contact Number" required>
</div>
</div>
<button type="button" onclick="addExternalContact()">Add Another External Contact</button>
</div>
<!-- Internal Contacts -->
<div class="field-group">
<label>Internal Email and Contact Numbers</label>
<div id="internalContacts" class="dynamic-fields">
<div class="internal-contact">
<input type="email" name="internalEmail[]" placeholder="Internal Email" required>
<input type="text" name="internalContact[]" placeholder="Internal Contact Number" required>
</div>
</div>
<button type="button" onclick="addInternalContact()">Add Another Internal Contact</button>
</div>
<!-- Upload Documents -->
<div class="field-group">
<label for="documents">Attach Documents</label>
<input type="file" id="documents" name="documents" multiple>
</div>
<!-- Initial Signature -->
<div class="field-group">
<label for="initialSignature">Initial Signature</label>
<input type="text" id="initialSignature" name="initialSignature" required>
</div>
<!-- Submit -->
<button type="button" onclick="displayConfirmationPage()">Submit</button>
</form>
<!-- Confirmation Page -->
<div id="confirmationPage">
<h2>Confirmation</h2>
<div id="confirmationDetails"></div>
<button type="button" onclick="submitForm()">Confirm and Send Email</button>
<button type="button" onclick="goBack()">Go Back</button>
</div>
<script>
function addExternalContact() {
const container = document.getElementById('externalContacts');
const newField = document.createElement('div');
newField.classList.add('external-contact');
newField.innerHTML = `
<input type="email" name="externalEmail[]" placeholder="External Email" required>
<input type="text" name="externalContact[]" placeholder="External Contact Number" required>
<button type="button" onclick="removeContact(this)">Remove</button>
`;
container.appendChild(newField);
}
function addInternalContact() {
const container = document.getElementById('internalContacts');
const newField = document.createElement('div');
newField.classList.add('internal-contact');
newField.innerHTML = `
<input type="email" name="internalEmail[]" placeholder="Internal Email" required>
<input type="text" name="internalContact[]" placeholder="Internal Contact Number" required>
<button type="button" onclick="removeContact(this)">Remove</button>
`;
container.appendChild(newField);
}
function removeContact(button) {
const fieldGroup = button.parentNode;
fieldGroup.parentNode.removeChild(fieldGroup);
}
function displayConfirmationPage() {
const form = document.getElementById('dynamicForm');
const confirmationPage = document.getElementById('confirmationPage');
const confirmationDetails = document.getElementById('confirmationDetails');
// Collect and display form data
let details = '<h3>Form Details</h3>';
details += `<p><strong>Title:</strong> ${form.title.value}</p>`;
details += `<p><strong>Department:</strong> ${form.department.value}</p>`;
// Display external contacts
details += '<p><strong>External Contacts:</strong></p>';
const externalEmails = form.querySelectorAll('input[name="externalEmail[]"]');
const externalContacts = form.querySelectorAll('input[name="externalContact[]"]');
externalEmails.forEach((email, index) => {
details += `<p>Email: ${email.value}, Contact: ${externalContacts[index].value}</p>`;
});
// Display internal contacts
details += '<p><strong>Internal Contacts:</strong></p>';
const internalEmails = form.querySelectorAll('input[name="internalEmail[]"]');
const internalContacts = form.querySelectorAll('input[name="internalContact[]"]');
internalEmails.forEach((email, index) => {
details += `<p>Email: ${email.value}, Contact: ${internalContacts[index].value}</p>`;
});
// Display initial signature
details += `<p><strong>Initial Signature:</strong> ${form.initialSignature.value}</p>`;
// Display attached documents
const documents = form.documents.files;
if (documents.length > 0) {
details += `<p><strong>Attached Documents:</strong> ${Array.from(documents).map(file => file.name).join(', ')}</p>`;
} else {
details += `<p><strong>Attached Documents:</strong> None</p>`;
}
confirmationDetails.innerHTML = details;
// Show confirmation page
form.style.display = 'none';
confirmationPage.style.display = 'block';
}
function goBack() {
document.getElementById('confirmationPage').style.display = 'none';
document.getElementById('dynamicForm').style.display = 'block';
}
function submitForm() {
const department = document.getElementById('department').value;
let email = '';
if (department === 'Legal' || department === 'HR') {
email = 'c.miranda@cosnova.com';
} else if (department === 'IT') {
email = 'a.rehbein@cosnova.com';
}
alert(`The form has been submitted to: ${email}`);
// Add backend integration here for submitting the form
}
</script>
</body>
</html>