-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscriptForm.js
More file actions
59 lines (47 loc) · 1.45 KB
/
scriptForm.js
File metadata and controls
59 lines (47 loc) · 1.45 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
// import { createHash } from 'crypto';
const checkbox=document.getElementById('suspectcheck');
const supectbox=document.getElementById('suspectdetails');
const declaration=document.getElementById('declaration');
const submit=document.getElementById('submit');
const inputclass=document.getElementsByClassName('inputclass');
checkbox.addEventListener('change', (event) => {
if (event.target.checked) {
supectbox.style.display = "block";
console.dir(inputclass);
} else {
supectbox.style.display = "none";
console.dir(inputclass);
}
});
declaration.addEventListener('change', (event) => {
if (event.target.checked) {
submit.disabled = false;
} else {
submit.disabled = true;
}
});
function validateinput(){
for(let i=0; i<inputclass.length; i++){
if(inputclass[i].value==''){
return false;
}
}
}
//read data from the form
submit.addEventListener('click', (event) => {
const object={};
for (let i=0; i<inputclass.length; i++) {
object[i]=inputclass[i].value;
}
const stri=JSON.stringify(object);
console.log(stri);
});
// function hashString(inputString) {
// const hash = createHash('sha256');
// hash.update(inputString);
// return hash.digest('hex');
// }
// // Example usage:
// const inputString = "Hello, World!";
// const hashedString = hashString(inputString);
// console.log("Hashed String:", hashedString);