forked from sohamsalkar/JSONpowerDB_L2X
-
Notifications
You must be signed in to change notification settings - Fork 0
/
registration.html
149 lines (133 loc) · 4.38 KB
/
registration.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
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
<!DOCTYPE html>
<html>
<head>
<title>Login2Xplore's JsonPowerDB</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="http://login2explore.com/jpdb/resources/js/0.0.3/jpdb-commons.js"></script>
<style type="text/css">
th
{
color: #000;
font-size: 24px;
font-weight: bold;
text-align: left;
}
td
{
color: #000;
}
body
{
background-color:#D3D3D3;
color:white;
font-family:verdana;
}
</style>
</head>
<body>
<form id="myForm" method="post">
<table width="700" border="0" align="center" cellpadding="0" cellspacing="5">
<tr>
<th width="25%" height="60"> </th>
<th><p>Registration Form</p></th>
<th width="10%"> </th>
</tr>
<tr>
<td><strong>Name:</strong></td>
<td><input id="name" name="name" type="text" size="35" required/></td>
<td> </td>
</tr>
<tr>
<td><strong>DOB:</strong></td>
<td><input id="dob" type="date" type="number" size="35" required/></td>
<td> </td>
</tr>
<tr>
<td><strong>Email:</strong></td>
<td><input id="email" name="email" type="email" size="35" required/></td>
<td> </td>
</tr>
<tr>
<td><strong>Department:</strong></td>
<td><select id="dept" name="dept" >
<option>Select..</option>
<option value="CS">Computer Science</option>
<option value="IT">Information Technology</option>
<option value="EXTC">Electronics and Communication</option>
<option value="MECH">Mechanical</option>
<option value="CVL">Civil</option>
</select>
</td>
<tr>
<td><strong>Mobile Number:</strong></td>
<td><input id="mobileno" name="mobileno" type="tel" size="35" placeholder="0123456789" pattern="[0-9]{10}"/></td>
<td> </td>
</tr>
</table>
<center>
<input type="reset" />
<input type="button" value="Register" onclick="registerCandidate();"/>
</center>
</form>
</body>
<script>
function createPUTRequest(connToken, jsonObj, dbName, relName) {
var putRequest = "{\n"
+ "\"token\" : \""
+ connToken
+ "\","
+ "\"dbName\": \""
+ dbName
+ "\",\n" + "\"cmd\" : \"PUT\",\n"
+ "\"rel\" : \""
+ relName + "\","
+ "\"jsonStr\": \n"
+ jsonObj
+ "\n"
+ "}";
return putRequest;
}
function executeCommand(reqString, dbBaseUrl, apiEndPointUrl) {
var url = dbBaseUrl + apiEndPointUrl;
var jsonObj;
$.post(url, reqString, function (result) {
jsonObj = JSON.parse(result);
}).fail(function (result) {
var dataJsonObj = result.responseText;
jsonObj = JSON.parse(dataJsonObj);
});
return jsonObj;
}
function validateAndGetFormData() {
var name = document.getElementById("name").value;
var dob = document.getElementById("dob").value;
var email = document.getElementById("email").value;
var dept = document.getElementById("dept").value;
var mobileno = document.getElementById("mobileno").value;
var jsonStrObj = {
StudentName: name,
DOB: dob,
Email: email,
Department: dept,
MobileNo: mobileno,
};
return JSON.stringify(jsonStrObj);
}
function registerCandidate() {
var jsonStr = validateAndGetFormData();
if (jsonStr === "") {
return;
}
var putReqStr = createPUTRequest("90935330|-31948798561083333|90934481",jsonStr, "PROJECT", "STD-DATA");
alert(putReqStr);
jQuery.ajaxSetup({async: false});
var resultObj = executeCommand(putReqStr,
"http://api.login2explore.com:5577", "/api/iml");
jQuery.ajaxSetup({async: true});
alert( "VALUES INSERTED "+ JSON.stringify(resultObj));
document.getElementById("myForm").reset();
}
</script>
</html>