-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquestionaire.html
More file actions
181 lines (154 loc) · 5.44 KB
/
Copy pathquestionaire.html
File metadata and controls
181 lines (154 loc) · 5.44 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Find the best country for you!</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>
<form id="questionaire" action="./canada.html" method=myFunciton()>
<div class="container-fluid">
<div class="form-group">
<label class="control-label" for="fleedFrom">Question 1: Where did you flee from?</label>
<input type="text" class="form-control">
<span aria-hidden="true"></span>
</div>
<div class="form-group">
<label class="control-label" for="Been">Question 2: Where have you been so far?</label>
<input type="text" class="form-control">
<span aria-hidden="true"></span>
</div>
<div class="form-group">
<label class="control-label" for="currently">Question 3: What country are you residing in currently?</label>
<input type="text" class="form-control">
<span aria-hidden="true"></span>
</div>
<p>
<label>Question 4: What is your gender?<br>
<select id="gender" name="gender">
<option value="n/a" selected="selected">Select One</option>
<option value="male" >Male</option>
<option value="female" >Female</option>
<option value="other" >Other</option>
</select>
</label>
</p>
<div class="form-group">
<label class="control-label" for="profession">Question 5: What is your profession??</label>
<input type="text" class="form-control">
<span aria-hidden="true"></span>
</div>
<div class="form-group">
<label class="control-label" for="skills">Question 6: What other skills do you have?</label>
<input type="text" class="form-control">
<span aria-hidden="true"></span>
</div>
<div class="form-group">
<label class="control-label" for="languages">Question 7: What languages do you speak?</label>
<input type="text" class="form-control">
<span aria-hidden="true"></span>
</div>
<div class="form-group">
<label class="control-label" for="kids?">Question 8: Do you have kids?</label>
<input type="text" class="form-control">
<span aria-hidden="true"></span>
</div>
<div class="form-group">
<label class="control-label" for="numberofKids">Question 9: If yes, how many?</label>
<input type="text" class="form-control">
<span aria-hidden="true"></span>
</div>
<div class="form-group">
<label class="control-label" for="otherfamily">Question 10: If you have other family, Where are your have family members located globally?</label>
<input type="text" class="form-control">
<span aria-hidden="true"></span>
</div>
<div class="form-group">
<label class="control-label" for="friends">Question 11: Do you have friends in other countries?</label>
<input type="text" class="form-control">
<span aria-hidden="true"></span>
</div>
<p><label for="rate">Question 12: Rank your financial situation(bad = 1, good = 10): </label>
<input type="range" min="0" max="10" id="rate" name="rate" value="0" oninput="thisRate.value = rate.value">
<output name="thisRate" for="range">0</output></p>
<br>
<input type="submit" onclick="myFunction()" value="Submit">
</div>
</form>
<!-- <button onclick="myFunction()">Try it</button> -->
<script>
function myFunction() {
var x = document.getElementById("questionaire");
var res= [];
var i;
for (i = 0; i < x.length - 1 ;i++) {
res.push(x.elements[i].value);
}
var options = {"usa" : 70, "ca" : 70, "au" : 70};
var fleed = res[0].toLowerCase(); //if country is iraq or syria add points for au
var been = res[1].toLowerCase(); //if country is au, ca, or usa decrease those respectivly
var residing = res[2].toLowerCase(); // if country is any of them decrease
var gender = res[3].toLowerCase();
var profession = res[4].toLowerCase();
var skills = res[5].toLowerCase();
var languages = res[6].toLowerCase();
var kids = res[7].toLowerCase();
var numberKids= res[8].toLowerCase();
var family = res[9].toLowerCase();
var friends = res[10].toLowerCase();
var finances = res[11].toLowerCase();
console.log(res);
var theThree = ["usa", "ca", "au"];
if (fleed.includes("iraq") || fleed.includes("syria")) {
options["au"] += 5;
}
if (been.includes("usa")){
options["usa"] -= 5;
}
if (been.includes("ca")) {
options["ca"] -= 5;
}
if (been.includes("au")) {
options["au"] -= 5;
}
if (languages.includes("french")) {
options["ca"] += 10;
}
if (family.includes("usa") || friends.includes("usa")){
options["usa"] += 15;
}
if (family.includes("ca") || friends.includes("ca")) {
options["ca"] += 15;
}
if (family.includes("au") || friends.includes("au")) {
options["au"] += 15;
}
if (parseInt(finances) < 5) {
options["ca"] += 5;
}
var i = 1;
var keys = Object.keys(options);
var mx = options[keys[0]]
var chosenOne = keys[0];
for (i; i<options.length;i++){
if (options[keys[i]] > mx) {
mx = options[keys[i]];
chosenOne = keys[i]
}
}
console.log(languages.includes("french"))
console.log(options);
res.push(chosenOne);
sessionStorage.setItem('response', res);
console.log(sessionStorage.getItem('response'));
}
</script>
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Bootstrap JS -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>
</html>