-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit_request.js
61 lines (45 loc) · 1.91 KB
/
submit_request.js
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
(function() {
"use strict";
//document.addEventListener('DOMContentLoaded', function() {
//checkboxSystem1.disabled = true;
// document.getElementById('radioCustomGroup').addEventListener('checked', removeDisabledChecked);
document.getElementById('formRequest').addEventListener('submit', submitRequest);
// document.getElementById('radioCustom').addEventListener('change', removeBlank);
var radioButtons = document.forms["formRequest"].elements["system"];
for(var i = 0, max = radioButtons.length; i < max; i++) {
radioButtons[i].addEventListener('change', removeBlank);
}
var checkboxSystem1 = document.getElementById('checkboxSystem1'),
checkboxSystem2 = document.getElementById('checkboxSystem2'),
checkboxSystem3 = document.getElementById('checkboxSystem3'),
checkboxSystem4 = document.getElementById('checkboxSystem4'),
checkboxSystem5 = document.getElementById('checkboxSystem5');
checkboxSystem1.disabled = true;
checkboxSystem2.disabled = true;
checkboxSystem3.disabled = true;
checkboxSystem4.disabled = true;
checkboxSystem5.disabled = true;
// });
function submitRequest(event) {
event.preventDefault();
console.log('it worked');
}
function removeBlank(event){
event.preventDefault();
if (document.getElementById('radioCustom').checked) {
checkboxSystem1.disabled = false;
checkboxSystem2.disabled = false;
checkboxSystem3.disabled = false;
checkboxSystem4.disabled = false;
checkboxSystem5.disabled = false;
} else {
checkboxSystem1.disabled = true;
checkboxSystem2.disabled = true;
checkboxSystem3.disabled = true;
checkboxSystem4.disabled = true;
checkboxSystem5.disabled = true;
}
console.log('it worked too!');
}
//function removeDisabledChecked()
})();