-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
120 lines (100 loc) · 4.31 KB
/
index.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Form Activation and Validation</title>
<meta name="description" content="Form Activation and Validation">
<meta name="author" content="Cassandra Marshall">
<link rel="stylesheet" href="styles.css">
<style>
.form-group {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
padding: 6px 12px;
}
.form-control {
display: block;
width: 40%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
-webkit-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
}
.form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control {
cursor: not-allowed;
background-color: #eee;
opacity: 1;
}
</style>
<script
src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha256-3edrmyuQ0w65f8gfBsqowzjJe2iM6n0nKciPUp8y+7E="
crossorigin="anonymous"></script>
</head>
<body>
<form>
<div class="form-group">
<label class="col-sm-4 control-label req" for="SocialSecurity" id="ss-req">Social Security Number</label>
<div class="col-sm-4">
<input class="form-control ssn" pattern="\d{3}[\-]\d{2}[\-]\d{4}" placeholder="123-45-6789" data-val="true" data-val-regex="Invalid Social Security Number" id="ss" name="SocialSecurity" required="required" type="text" value="" />
</div>
<span class="field-validation-valid" data-valmsg-for="SocialSecurity" data-valmsg-replace="true"></span>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="Taxpayer" id="tax-req">Taxpayer Identification Number</label>
<input class="ss_tax" data-val="true" data-val-required="Social Security or Taypayer ID" id="ss_tax" name="ss_tax" type="checkbox" value="false">
<div class="col-sm-4">
<input class="form-control tin" placeholder="12-3456789" pattern="\d{2}[\-]\d{7}" data-val="true" data-val-regex="Invalid Taxpayer Identification Number" disabled="disabled" id="tax" name="Taxpayer" type="text" value="" />
</div>
<span class="field-validation-valid" data-valmsg-for="Taxpayer" data-valmsg-replace="true"></span>
</div>
<div class="form-group centertext">
<button type="submit" id="SubmitClaim" class="btn btn-submit">
Agree and Submit
</button>
</div>
</form>
<script>
$('#ss_tax').click(function () {
if (this.checked) {
$('#tax').prop('disabled', false); // If checked disable item
$('#ss').prop('disabled', true); // If checked enable item
$('#tax').prop('required', true); // If checked disable item
$('#ss').prop('required', false); // If checked enable item
$('#ss').val(''); // clear input
$('#ss-error').hide(); // clear input
$('#ss-req').removeClass('req'); //remove req from ss
$('#tax-req').addClass('req'); //remove req from tax
} else {
$('#tax').prop('disabled', true); // If checked enable item
$('#ss').prop('disabled', false); // If checked disable item
$('#tax').prop('required', false); // If checked disable item
$('#ss').prop('required', true); // If checked enable item
$('#tax').val(''); // clear input
$('#tax-error').hide(); // clear input
$('#ss-req').addClass('req'); //remove req from tax
$('#tax-req').removeClass('req'); //remove req from ss
}
});
$('claimForm').validate({
rules: {
SocialSecurity: 'required',
Taxpayer: 'required'
},
messages: {
SocialSecurity: 'Required',
Taxpayer: 'Required'
}
});
</script>
</body>
</html>