Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
LaMartin-Webomagic
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Deep Dey
LaMartin-Webomagic
Commits
29f9b34a
Commit
29f9b34a
authored
Jul 04, 2024
by
Deep Dey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add validation and new feature according to client
parent
d33172ec
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
377 additions
and
61 deletions
+377
-61
lamartinFrontend/index.html
lamartinFrontend/index.html
+118
-17
lamartinFrontend/main.js
lamartinFrontend/main.js
+259
-44
No files found.
lamartinFrontend/index.html
View file @
29f9b34a
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<head>
<head>
<meta
charset=
"UTF-8"
>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
Document
</title>
<title>
Application For Admission - La Martiniere
</title>
<link
rel=
"preconnect"
href=
"https://fonts.googleapis.com"
>
<link
rel=
"preconnect"
href=
"https://fonts.googleapis.com"
>
<link
rel=
"preconnect"
href=
"https://fonts.gstatic.com"
crossorigin
>
<link
rel=
"preconnect"
href=
"https://fonts.gstatic.com"
crossorigin
>
<link
<link
...
@@ -31,23 +31,53 @@
...
@@ -31,23 +31,53 @@
<select
name=
"school"
class=
"la-form-control"
>
<select
name=
"school"
class=
"la-form-control"
>
<option
value=
""
>
Select an School
</option>
<option
value=
""
>
Select an School
</option>
<option
value=
"La Martiniere for Boys"
>
La Martiniere for Boys
</option>
<option
value=
"La Martiniere for Boys"
>
La Martiniere for Boys
</option>
<option
value=
"La Martiniere for Girls"
>
La Martiniere for
g
irls
</option>
<option
value=
"La Martiniere for Girls"
>
La Martiniere for
G
irls
</option>
</select>
</select>
<div
class=
"la-invalid-feedback"
></div>
<div
class=
"la-invalid-feedback"
></div>
<small>
Please specify Choice of School
</small>
<small>
Please specify Choice of School
</small>
</div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
<label
for=
"category"
>
Category
<span>
*
</span></label>
<label
for=
"category"
>
Category
<span>
*
</span></label>
<select
name=
"category"
class=
"la-form-control"
>
<select
id=
"category"
name=
"category"
class=
"la-form-control"
>
<option
value=
""
>
Specify Category
</option>
<option
value=
""
>
Specify Category
</option>
<option
value=
"General"
>
General
</option>
<option
value=
"Brother / Sister(Not Cousins) studying at La Martiniere, Kolkata"
>
Brother /
<option
value=
"Brother / Sister(Not Cousins) studying at La Martiniere, Kolkata"
>
Brother /
Sister(Not Cousins) studying at La Martiniere, Kolkata
</option>
Sister(Not Cousins) studying at La Martiniere, Kolkata
</option>
<option
value=
"Staff Child"
>
Staff Child
</option>
<option
value=
"Staff Child"
>
Staff Child
</option>
<option
value=
"
Other"
>
Other
</option>
<option
value=
"
Ex-Student"
>
Ex-Student
</option>
</select>
</select>
<div
class=
"la-invalid-feedback"
></div>
<div
class=
"la-invalid-feedback"
></div>
<small>
Please specify Category
</small>
<small>
Please specify Category
</small>
</div>
</div>
<div
id=
"staffDepartmentContainer"
class=
"la-form-group"
>
<label
for=
"staffDepartment"
>
Staff Department
<span>
*
</span></label>
<select
id=
"staffDepartment"
name=
"staffDepartment"
class=
"la-form-control"
>
<option
value=
""
>
Specify Staff Department
</option>
<option
value=
"Teaching"
>
Teaching
</option>
<option
value=
"Non-Teaching"
>
Non-Teaching
</option>
</select>
<div
class=
"la-invalid-feedback"
></div>
</div>
<div
id=
"staffCategoryContainer"
class=
"la-form-group"
>
<label
for=
"staffCategory"
>
Staff Category
<span>
*
</span></label>
<select
id=
"staffCategory"
name=
"staffCategory"
class=
"la-form-control"
>
<option
value=
""
>
Specify Staff Category
</option>
<option
value=
"Permanent"
>
Permanent
</option>
<option
value=
"On Probation"
>
On Probation
</option>
<option
value=
"Contractual"
>
Contractual
</option>
</select>
<div
class=
"la-invalid-feedback"
></div>
</div>
<div
id=
"exStudentInfoContainer"
class=
"la-form-group"
>
<label
for=
"exStudentInfo"
>
Parent who is/are ex-student
<span>
*
</span></label>
<select
id=
"exStudentInfo"
name=
"exStudentInfo"
class=
"la-form-control"
>
<option
value=
""
>
Mention Parent who is/are ex-student
</option>
<option
value=
"Father"
>
Father is an ex-student
</option>
<option
value=
"Mother"
>
Mother is an ex-student
</option>
<option
value=
"Both"
>
Both Father and Mother are ex-students
</option>
</select>
<div
class=
"la-invalid-feedback"
></div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
<label
for=
"fullName"
>
Full Name
<span>
*
</span></label>
<label
for=
"fullName"
>
Full Name
<span>
*
</span></label>
<input
type=
"text"
name=
"fullName"
class=
"la-form-control"
>
<input
type=
"text"
name=
"fullName"
class=
"la-form-control"
>
...
@@ -62,15 +92,13 @@
...
@@ -62,15 +92,13 @@
<!-- <option value="Upper Nursery">Upper Nursery</option> -->
<!-- <option value="Upper Nursery">Upper Nursery</option> -->
</select>
</select>
<div
class=
"la-invalid-feedback"
></div>
<div
class=
"la-invalid-feedback"
></div>
<small>
Please specify class in which admission is sought. (based on the selection of Class – the
<small>
Please specify class in which admission is sought. (based on the selection of Class – the year of Birth is automatically fixed)
</small>
year of Birth is automatically fixed)
</small>
</div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
<label
for=
"dateOfBirth"
>
Date of Birth
<span>
*
</span></label>
<label
for=
"dateOfBirth"
>
Date of Birth
<span>
*
</span></label>
<input
type=
"date"
name=
"dateOfBirth"
id=
"dateOfBirth"
class=
"la-form-control"
>
<input
type=
"date"
name=
"dateOfBirth"
id=
"dateOfBirth"
class=
"la-form-control"
>
<div
class=
"la-invalid-feedback"
></div>
<div
class=
"la-invalid-feedback"
></div>
<small>
Date of Birth - as given in the Municipal Corporation Birth Certificate/Baptism
<small>
Date of Birth - as given in the Municipal Corporation Birth Certificate/Baptism Certificate
</small>
Certificate
</small>
</div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
<label
for=
"nationality"
>
Nationality
<span>
*
</span></label>
<label
for=
"nationality"
>
Nationality
<span>
*
</span></label>
...
@@ -79,7 +107,26 @@
...
@@ -79,7 +107,26 @@
</div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
<label
for=
"religion"
>
Religion
<span>
*
</span></label>
<label
for=
"religion"
>
Religion
<span>
*
</span></label>
<input
type=
"text"
name=
"religion"
class=
"la-form-control"
>
<select
id=
"religion"
name=
"religion"
class=
"la-form-control"
>
<option
value=
""
>
Specify Religion
</option>
<option
value=
"Christian"
>
Christian
</option>
<option
value=
"Hindu"
>
Hindu
</option>
<option
value=
"Muslim"
>
Muslim
</option>
<option
value=
"Sikh"
>
Sikh
</option>
<option
value=
"Buddhist"
>
Buddhist
</option>
<option
value=
"Jain"
>
Jain
</option>
<option
value=
"Other"
>
Other
</option>
</select>
<div
class=
"la-invalid-feedback"
></div>
</div>
<div
id=
"denominationContainer"
class=
"la-form-group"
>
<label
for=
"denomination"
>
Denomination
<span>
*
</span></label>
<input
id=
"denomination"
type=
"text"
name=
"denomination"
class=
"la-form-control"
>
<div
class=
"la-invalid-feedback"
></div>
</div>
<div
id=
"churchContainer"
class=
"la-form-group"
>
<label
for=
"church"
>
Church
<span>
*
</span></label>
<input
id=
"church"
type=
"text"
name=
"church"
class=
"la-form-control"
>
<div
class=
"la-invalid-feedback"
></div>
<div
class=
"la-invalid-feedback"
></div>
</div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
...
@@ -93,6 +140,22 @@
...
@@ -93,6 +140,22 @@
<div
class=
"la-invalid-feedback"
></div>
<div
class=
"la-invalid-feedback"
></div>
<small>
Socio- Linguistic community (eg Bengali, Punjabi, Marwari, Jain etc.)
</small>
<small>
Socio- Linguistic community (eg Bengali, Punjabi, Marwari, Jain etc.)
</small>
</div>
</div>
<div
class=
"la-form-group"
>
<label
for=
"homeAddress"
>
Home Address
<span>
*
</span></label>
<input
id=
"homeAddress"
type=
"text"
name=
"homeAddress"
class=
"la-form-control"
>
<div
class=
"la-invalid-feedback"
></div>
</div>
<div
class=
"la-form-group form-check"
>
<input
class=
"form-check-input"
type=
"checkbox"
value=
""
id=
"addressCheck"
>
<label
class=
"form-check-label"
for=
"flexCheckDefault"
>
Correspondence Address same as Home Address
</label>
</div>
<div
class=
"la-form-group"
>
<label
for=
"correspondenceAddress"
>
Correspondence Address
<span>
*
</span></label>
<input
id=
"correspondenceAddress"
type=
"text"
name=
"correspondenceAddress"
class=
"la-form-control"
>
<div
class=
"la-invalid-feedback"
></div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
<label
for=
"otherChildren"
>
Details of Other Children
</label>
<label
for=
"otherChildren"
>
Details of Other Children
</label>
<input
type=
"text"
name=
"otherChildren"
class=
"la-form-control"
>
<input
type=
"text"
name=
"otherChildren"
class=
"la-form-control"
>
...
@@ -104,7 +167,7 @@
...
@@ -104,7 +167,7 @@
<h4>
PARENT INFORMATION
</h4>
<h4>
PARENT INFORMATION
</h4>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
<label
for=
"maritalStatus"
>
Marital Status
<span>
*
</span></label>
<label
for=
"maritalStatus"
>
Marital Status
<span>
*
</span></label>
<select
name=
"maritalStatus"
class=
"la-form-control"
>
<select
id=
"maritalStatus"
name=
"maritalStatus"
class=
"la-form-control"
>
<option
value=
""
>
Choose an option
</option>
<option
value=
""
>
Choose an option
</option>
<option
value=
"Married"
>
Married
</option>
<option
value=
"Married"
>
Married
</option>
<option
value=
"Separated"
>
Separated
</option>
<option
value=
"Separated"
>
Separated
</option>
...
@@ -138,7 +201,26 @@
...
@@ -138,7 +201,26 @@
</div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
<label
for=
"fatherReligion"
>
Religion
<span>
*
</span></label>
<label
for=
"fatherReligion"
>
Religion
<span>
*
</span></label>
<input
type=
"text"
name=
"fatherReligion"
class=
"la-form-control"
>
<select
id=
"fatherReligion"
name=
"fatherReligion"
class=
"la-form-control"
>
<option
value=
""
>
Specify Religion
</option>
<option
value=
"Christian"
>
Christian
</option>
<option
value=
"Hindu"
>
Hindu
</option>
<option
value=
"Muslim"
>
Muslim
</option>
<option
value=
"Sikh"
>
Sikh
</option>
<option
value=
"Buddhist"
>
Buddhist
</option>
<option
value=
"Jain"
>
Jain
</option>
<option
value=
"Other"
>
Other
</option>
</select>
<div
class=
"la-invalid-feedback"
></div>
</div>
<div
id=
"fatherDenominationContainer"
class=
"la-form-group"
>
<label
for=
"fatherDenomination"
>
Denomination
<span>
*
</span></label>
<input
id=
"fatherDenomination"
type=
"text"
name=
"fatherDenomination"
class=
"la-form-control"
>
<div
class=
"la-invalid-feedback"
></div>
</div>
<div
id=
"fatherChurchContainer"
class=
"la-form-group"
>
<label
for=
"fatherChurch"
>
Church
<span>
*
</span></label>
<input
id=
"fatherChurch"
type=
"text"
name=
"fatherChurch"
class=
"la-form-control"
>
<div
class=
"la-invalid-feedback"
></div>
<div
class=
"la-invalid-feedback"
></div>
</div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
...
@@ -198,12 +280,12 @@
...
@@ -198,12 +280,12 @@
</div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
<label
for=
"motherEmail"
>
Email
</label>
<label
for=
"motherEmail"
>
Email
</label>
<input
type=
"email"
name=
"motherEmail"
class=
"la-form-control"
>
<input
id=
"motherEmail"
type=
"email"
name=
"motherEmail"
class=
"la-form-control"
>
<div
class=
"la-invalid-feedback"
></div>
<div
class=
"la-invalid-feedback"
></div>
</div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
<label
for=
"motherMobile"
>
Phone
</label>
<label
for=
"motherMobile"
>
Phone
</label>
<input
type=
"text"
name=
"motherMobile"
class=
"la-form-control"
>
<input
id=
"motherMobile"
type=
"text"
name=
"motherMobile"
class=
"la-form-control"
>
<div
class=
"la-invalid-feedback"
></div>
<div
class=
"la-invalid-feedback"
></div>
</div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
...
@@ -213,7 +295,26 @@
...
@@ -213,7 +295,26 @@
</div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
<label
for=
"motherReligion"
>
Religion
<span>
*
</span></label>
<label
for=
"motherReligion"
>
Religion
<span>
*
</span></label>
<input
type=
"text"
name=
"motherReligion"
class=
"la-form-control"
>
<select
id=
"motherReligion"
name=
"motherReligion"
class=
"la-form-control"
>
<option
value=
""
>
Specify Religion
</option>
<option
value=
"Christian"
>
Christian
</option>
<option
value=
"Hindu"
>
Hindu
</option>
<option
value=
"Muslim"
>
Muslim
</option>
<option
value=
"Sikh"
>
Sikh
</option>
<option
value=
"Buddhist"
>
Buddhist
</option>
<option
value=
"Jain"
>
Jain
</option>
<option
value=
"Other"
>
Other
</option>
</select>
<div
class=
"la-invalid-feedback"
></div>
</div>
<div
id=
"motherDenominationContainer"
class=
"la-form-group"
>
<label
for=
"motherDenomination"
>
Denomination
<span>
*
</span></label>
<input
id=
"motherDenomination"
type=
"text"
name=
"motherDenomination"
class=
"la-form-control"
>
<div
class=
"la-invalid-feedback"
></div>
</div>
<div
id=
"motherChurchContainer"
class=
"la-form-group"
>
<label
for=
"motherChurch"
>
Church
<span>
*
</span></label>
<input
id=
"motherChurch"
type=
"text"
name=
"motherChurch"
class=
"la-form-control"
>
<div
class=
"la-invalid-feedback"
></div>
<div
class=
"la-invalid-feedback"
></div>
</div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
...
@@ -275,14 +376,14 @@
...
@@ -275,14 +376,14 @@
</div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
<img
id=
"fatherImage"
class=
"image-preview"
src=
"./img/father.png"
alt=
"father photo"
>
<img
id=
"fatherImage"
class=
"image-preview"
src=
"./img/father.png"
alt=
"father photo"
>
<label
for=
"fatherImage"
style=
"text-align: center;"
>
Guardian's Photo
</label>
<label
for=
"fatherImage"
style=
"text-align: center;"
>
Father's/
Guardian's Photo
</label>
<input
type=
"file"
name=
"fatherImage"
class=
"la-form-control"
>
<input
type=
"file"
name=
"fatherImage"
class=
"la-form-control"
>
<div
class=
"la-invalid-feedback"
></div>
<div
class=
"la-invalid-feedback"
></div>
</div>
</div>
<div
class=
"la-form-group"
>
<div
class=
"la-form-group"
>
<img
id=
"motherImage"
class=
"image-preview"
src=
"./img/mother.png"
alt=
"mother photo"
>
<img
class=
"image-preview"
src=
"./img/mother.png"
alt=
"mother photo"
>
<label
for=
"motherImage"
>
Mother's Photo
</label>
<label
for=
"motherImage"
>
Mother's Photo
</label>
<input
type=
"file"
name=
"motherImage"
class=
"la-form-control"
>
<input
id=
"motherImage"
type=
"file"
name=
"motherImage"
class=
"la-form-control"
>
<div
class=
"la-invalid-feedback"
></div>
<div
class=
"la-invalid-feedback"
></div>
</div>
</div>
</div>
</div>
...
...
lamartinFrontend/main.js
View file @
29f9b34a
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'
#staffDepartmentContainer
'
).
hide
();
$
(
'
#staffCategoryContainer
'
).
hide
();
$
(
'
#exStudentInfoContainer
'
).
hide
();
$
(
'
#denominationContainer
'
).
hide
();
$
(
'
#churchContainer
'
).
hide
();
$
(
'
#fatherDenominationContainer
'
).
hide
();
$
(
'
#fatherChurchContainer
'
).
hide
();
$
(
'
#motherDenominationContainer
'
).
hide
();
$
(
'
#motherChurchContainer
'
).
hide
();
$
(
'
#addressCheck
'
).
click
(
function
()
{
if
(
$
(
this
).
is
(
'
:checked
'
))
{
$
(
'
#correspondenceAddress
'
).
prop
(
'
disabled
'
,
true
)
$
(
'
#correspondenceAddress
'
).
val
(
$
(
'
#homeAddress
'
).
val
());
}
else
{
$
(
'
#correspondenceAddress
'
).
prop
(
'
disabled
'
,
false
);
}
});
$
(
'
#homeAddress
'
).
on
(
'
input
'
,
function
()
{
if
(
$
(
'
#addressCheck
'
).
is
(
'
:checked
'
))
{
$
(
'
#correspondenceAddress
'
).
val
(
$
(
'
#homeAddress
'
).
val
());
}
})
//TODO: depending on class it will set the min and max date
//TODO: depending on class it will set the min and max date
$
(
'
#dateOfBirth
'
).
click
(
function
()
{
$
(
'
#dateOfBirth
'
).
click
(
function
()
{
var
currentDate
=
new
Date
();
var
currentDate
=
new
Date
();
var
currentYear
=
currentDate
.
getFullYear
();
var
currentYear
=
currentDate
.
getFullYear
();
var
upperLimitDate
=
new
Date
(
currentYear
-
2
,
11
,
31
);
// 2 years back, December 31st
var
upperLimitDate
=
new
Date
(
currentYear
-
1
,
0
,
1
);
var
lowerLimitDate
=
new
Date
(
currentYear
-
3
,
0
,
1
);
// 4 years back, January 1st
var
lowerLimitDate
=
new
Date
(
currentYear
-
2
,
0
,
2
);
// Format the dates as YYYY-MM-DD strings
// Format the dates as YYYY-MM-DD strings
var
upperLimitDateString
=
upperLimitDate
.
toISOString
().
split
(
'
T
'
)[
0
];
var
upperLimitDateString
=
upperLimitDate
.
toISOString
().
split
(
'
T
'
)[
0
];
...
@@ -15,6 +44,52 @@ $(document).ready(function () {
...
@@ -15,6 +44,52 @@ $(document).ready(function () {
$
(
'
#dateOfBirth
'
).
attr
(
'
min
'
,
lowerLimitDateString
);
$
(
'
#dateOfBirth
'
).
attr
(
'
min
'
,
lowerLimitDateString
);
});
});
$
(
'
#category
'
).
on
(
'
change
'
,
function
()
{
if
(
$
(
this
).
val
()
===
'
Staff Child
'
)
{
$
(
'
#staffDepartmentContainer
'
).
show
();
$
(
'
#staffCategoryContainer
'
).
show
();
$
(
'
#exStudentInfoContainer
'
).
hide
();
}
else
if
(
$
(
this
).
val
()
===
'
Ex-Student
'
)
{
$
(
'
#exStudentInfoContainer
'
).
show
();
$
(
'
#staffDepartmentContainer
'
).
hide
();
$
(
'
#staffCategoryContainer
'
).
hide
();
}
else
{
$
(
'
#staffDepartmentContainer
'
).
hide
();
$
(
'
#staffCategoryContainer
'
).
hide
();
$
(
'
#exStudentInfoContainer
'
).
hide
();
}
});
$
(
'
#religion
'
).
on
(
'
change
'
,
function
()
{
if
(
$
(
this
).
val
()
===
'
Christian
'
)
{
$
(
'
#denominationContainer
'
).
show
();
$
(
'
#churchContainer
'
).
show
();
}
else
{
$
(
'
#denominationContainer
'
).
hide
();
$
(
'
#churchContainer
'
).
hide
();
}
});
$
(
'
#fatherReligion
'
).
on
(
'
change
'
,
function
()
{
if
(
$
(
this
).
val
()
===
'
Christian
'
)
{
$
(
'
#fatherDenominationContainer
'
).
show
();
$
(
'
#fatherChurchContainer
'
).
show
();
}
else
{
$
(
'
#fatherDenominationContainer
'
).
hide
();
$
(
'
#fatherChurchContainer
'
).
hide
();
}
});
$
(
'
#motherReligion
'
).
on
(
'
change
'
,
function
()
{
if
(
$
(
this
).
val
()
===
'
Christian
'
)
{
$
(
'
#motherDenominationContainer
'
).
show
();
$
(
'
#motherChurchContainer
'
).
show
();
}
else
{
$
(
'
#motherDenominationContainer
'
).
hide
();
$
(
'
#motherChurchContainer
'
).
hide
();
}
});
function
readURL
(
input
,
previewId
)
{
function
readURL
(
input
,
previewId
)
{
if
(
input
.
files
&&
input
.
files
[
0
])
{
if
(
input
.
files
&&
input
.
files
[
0
])
{
var
reader
=
new
FileReader
();
var
reader
=
new
FileReader
();
...
@@ -70,48 +145,48 @@ $(document).ready(function () {
...
@@ -70,48 +145,48 @@ $(document).ready(function () {
$
(
'
#application-form
'
).
validate
({
$
(
'
#application-form
'
).
validate
({
rules
:
{
rules
:
{
school
:
'
required
'
,
//
school: 'required',
category
:
'
required
'
,
//
category: 'required',
fullName
:
'
required
'
,
//
fullName: 'required',
admissionClass
:
'
required
'
,
//
admissionClass: 'required',
dateOfBirth
:
'
required
'
,
//
dateOfBirth: 'required',
nationality
:
'
required
'
,
//
nationality: 'required',
religion
:
'
required
'
,
//
religion: 'required',
motherTongue
:
'
required
'
,
//
motherTongue: 'required',
community
:
'
required
'
,
//
community: 'required',
maritalStatus
:
'
required
'
,
//
maritalStatus: 'required',
fatherName
:
'
required
'
,
//
fatherName: 'required',
fatherEmail
:
'
required
'
,
//
fatherEmail: 'required',
fatherMobile
:
{
//
fatherMobile: {
required
:
true
,
//
required: true,
regex
:
/^
[
0-9
]{10}
$/
,
//
regex: /^[0-9]{10}$/,
},
//
},
fatherNationality
:
'
required
'
,
//
fatherNationality: 'required',
fatherReligion
:
'
required
'
,
//
fatherReligion: 'required',
fatherMotherTongue
:
'
required
'
,
//
fatherMotherTongue: 'required',
fatherCommunity
:
'
required
'
,
//
fatherCommunity: 'required',
fatherSchoolInfo
:
'
required
'
,
//
fatherSchoolInfo: 'required',
fatherOccupation
:
'
required
'
,
//
fatherOccupation: 'required',
fatherMonthlyIncome
:
'
required
'
,
//
fatherMonthlyIncome: 'required',
motherName
:
'
required
'
,
//
motherName: 'required',
motherMobile
:
{
//
motherMobile: {
regex
:
/^
[
0-9
]{10}
$/
,
//
regex: /^[0-9]{10}$/,
},
//
},
motherNationality
:
'
required
'
,
//
motherNationality: 'required',
motherReligion
:
'
required
'
,
//
motherReligion: 'required',
motherMotherTongue
:
'
required
'
,
//
motherMotherTongue: 'required',
motherCommunity
:
'
required
'
,
//
motherCommunity: 'required',
motherSchoolInfo
:
'
required
'
,
//
motherSchoolInfo: 'required',
candidateImage
:
{
//
candidateImage: {
required
:
true
,
//
required: true,
extension
:
[
'
jpg
'
,
'
png
'
,
'
jpeg
'
,
'
svg
'
],
//
extension: ['jpg', 'png', 'jpeg', 'svg'],
fileSize
:
1
*
1024
*
1024
,
//
fileSize: 1 * 1024 * 1024,
},
//
},
fatherImage
:
{
//
fatherImage: {
required
:
true
,
//
required: true,
extension
:
[
'
jpg
'
,
'
png
'
,
'
jpeg
'
,
'
svg
'
],
//
extension: ['jpg', 'png', 'jpeg', 'svg'],
fileSize
:
1
*
1024
*
1024
,
//
fileSize: 1 * 1024 * 1024,
},
//
},
// motherImage: {
// motherImage: {
// required: true,
// required: true,
// extension: ['jpg', 'png', 'jpeg', 'svg'],
// extension: ['jpg', 'png', 'jpeg', 'svg'],
...
@@ -183,6 +258,13 @@ $(document).ready(function () {
...
@@ -183,6 +258,13 @@ $(document).ready(function () {
var
formData
=
new
FormData
(
form
);
var
formData
=
new
FormData
(
form
);
let
jsonData
=
{};
let
jsonData
=
{};
//TODO: validate the form for custom validations
let
reconfiguredFormData
=
reconfigureFormData
(
formData
);
if
(
!
reconfiguredFormData
)
{
return
false
;
}
$
(
'
.loader
'
).
css
(
'
display
'
,
'
inline-block
'
);
$
(
'
.loader
'
).
css
(
'
display
'
,
'
inline-block
'
);
$
(
'
.btn-text
'
).
css
(
'
display
'
,
'
none
'
);
$
(
'
.btn-text
'
).
css
(
'
display
'
,
'
none
'
);
$
(
'
#btn-sumbit
'
).
prop
(
'
disabled
'
,
true
);
$
(
'
#btn-sumbit
'
).
prop
(
'
disabled
'
,
true
);
...
@@ -226,4 +308,137 @@ $(document).ready(function () {
...
@@ -226,4 +308,137 @@ $(document).ready(function () {
return
false
;
return
false
;
},
},
});
});
function
reconfigureFormData
(
formData
)
{
let
reconfiguredFormData
=
new
FormData
();
reconfiguredFormData
=
formData
;
var
errorElements
=
[];
// conditional validation on category
if
(
formData
.
get
(
'
category
'
)
===
'
Staff Child
'
)
{
if
(
!
formData
.
get
(
'
staffDepartment
'
))
{
$
(
'
#staffDepartment
'
).
addClass
(
'
is-invalid
'
);
$
(
'
#staffDepartment
'
).
next
(
'
.la-invalid-feedback
'
).
html
(
'
Please select the staff department
'
);
$
(
'
#staffDepartment
'
).
prev
(
'
label
'
).
addClass
(
'
is-invalid
'
);
errorElements
.
push
(
'
#staffDepartment
'
);
}
if
(
!
formData
.
get
(
'
staffCategory
'
))
{
$
(
'
#staffCategory
'
).
addClass
(
'
is-invalid
'
);
$
(
'
#staffCategory
'
).
next
(
'
.la-invalid-feedback
'
).
html
(
'
Please select the staff category
'
);
$
(
'
#staffCategory
'
).
prev
(
'
label
'
).
addClass
(
'
is-invalid
'
);
errorElements
.
push
(
'
#staffCategory
'
);
}
reconfiguredFormData
.
set
(
'
exStudentInfo
'
,
''
);
}
else
if
(
formData
.
get
(
'
category
'
)
===
'
Ex-Student
'
)
{
if
(
!
formData
.
get
(
'
exStudentInfo
'
))
{
$
(
'
#exStudentInfo
'
).
addClass
(
'
is-invalid
'
);
$
(
'
#exStudentInfo
'
).
next
(
'
.la-invalid-feedback
'
).
html
(
'
Please select ex-student
'
);
$
(
'
#exStudentInfo
'
).
prev
(
'
label
'
).
addClass
(
'
is-invalid
'
);
errorElements
.
push
(
'
#exStudentInfo
'
);
}
reconfiguredFormData
.
set
(
'
staffDepartment
'
,
''
);
reconfiguredFormData
.
set
(
'
staffCategory
'
,
''
);
}
else
{
reconfiguredFormData
.
set
(
'
staffDepartment
'
,
''
);
reconfiguredFormData
.
set
(
'
staffCategory
'
,
''
);
reconfiguredFormData
.
set
(
'
exStudentInfo
'
,
''
);
}
// conditional validation on candidate religion
if
(
formData
.
get
(
'
religion
'
)
===
'
Christian
'
)
{
if
(
!
formData
.
get
(
'
denomination
'
))
{
$
(
'
#denomination
'
).
addClass
(
'
is-invalid
'
);
$
(
'
#denomination
'
).
next
(
'
.la-invalid-feedback
'
).
html
(
'
Please provide the denomination
'
);
$
(
'
#denomination
'
).
prev
(
'
label
'
).
addClass
(
'
is-invalid
'
);
errorElements
.
push
(
'
#denomination
'
);
}
if
(
!
formData
.
get
(
'
church
'
))
{
$
(
'
#church
'
).
addClass
(
'
is-invalid
'
);
$
(
'
#church
'
).
next
(
'
.la-invalid-feedback
'
).
html
(
'
Please provide the church name
'
);
$
(
'
#church
'
).
prev
(
'
label
'
).
addClass
(
'
is-invalid
'
);
errorElements
.
push
(
'
#church
'
);
}
}
else
{
reconfiguredFormData
.
set
(
'
denomination
'
,
''
);
reconfiguredFormData
.
set
(
'
church
'
,
''
);
}
// conditional validation on candidate father's religion
if
(
formData
.
get
(
'
fatherReligion
'
)
===
'
Christian
'
)
{
if
(
!
formData
.
get
(
'
fatherDenomination
'
))
{
$
(
'
#fatherDenomination
'
).
addClass
(
'
is-invalid
'
);
$
(
'
#fatherDenomination
'
).
next
(
'
.la-invalid-feedback
'
).
html
(
'
Please provide the denomination
'
);
$
(
'
#fatherDenomination
'
).
prev
(
'
label
'
).
addClass
(
'
is-invalid
'
);
errorElements
.
push
(
'
#fatherDenomination
'
);
}
if
(
!
formData
.
get
(
'
fatherChurch
'
))
{
$
(
'
#fatherChurch
'
).
addClass
(
'
is-invalid
'
);
$
(
'
#fatherChurch
'
).
next
(
'
.la-invalid-feedback
'
).
html
(
'
Please provide the church name
'
);
$
(
'
#fatherChurch
'
).
prev
(
'
label
'
).
addClass
(
'
is-invalid
'
);
errorElements
.
push
(
'
#fatherChurch
'
);
}
}
else
{
reconfiguredFormData
.
set
(
'
fatherDenomination
'
,
''
);
reconfiguredFormData
.
set
(
'
fatherChurch
'
,
''
);
}
// conditional validation on candidate mother's religion
if
(
formData
.
get
(
'
motherReligion
'
)
===
'
Christian
'
)
{
if
(
!
formData
.
get
(
'
motherDenomination
'
))
{
$
(
'
#motherDenomination
'
).
addClass
(
'
is-invalid
'
);
$
(
'
#motherDenomination
'
).
next
(
'
.la-invalid-feedback
'
).
html
(
'
Please provide the denomination
'
);
$
(
'
#motherDenomination
'
).
prev
(
'
label
'
).
addClass
(
'
is-invalid
'
);
errorElements
.
push
(
'
#motherDenomination
'
);
}
if
(
!
formData
.
get
(
'
motherChurch
'
))
{
$
(
'
#motherChurch
'
).
addClass
(
'
is-invalid
'
);
$
(
'
#motherChurch
'
).
next
(
'
.la-invalid-feedback
'
).
html
(
'
Please provide the church name
'
);
$
(
'
#motherChurch
'
).
prev
(
'
label
'
).
addClass
(
'
is-invalid
'
);
errorElements
.
push
(
'
#motherChurch
'
);
}
}
else
{
reconfiguredFormData
.
set
(
'
motherDenomination
'
,
''
);
reconfiguredFormData
.
set
(
'
motherChurch
'
,
''
);
}
if
(
formData
.
get
(
'
maritalStatus
'
)
===
'
Married
'
)
{
if
(
!
formData
.
get
(
'
motherEmail
'
))
{
$
(
'
#motherEmail
'
).
addClass
(
'
is-invalid
'
);
$
(
'
#motherEmail
'
).
next
(
'
.la-invalid-feedback
'
).
html
(
'
For Marital Status Married, Please provide mother email
'
);
$
(
'
#motherEmail
'
).
prev
(
'
label
'
).
addClass
(
'
is-invalid
'
);
errorElements
.
push
(
'
#motherEmail
'
);
}
if
(
!
formData
.
get
(
'
motherMobile
'
))
{
$
(
'
#motherMobile
'
).
addClass
(
'
is-invalid
'
);
$
(
'
#motherMobile
'
).
next
(
'
.la-invalid-feedback
'
).
html
(
'
For Marital Status Married, Please provide mother mobile
'
);
$
(
'
#motherMobile
'
).
prev
(
'
label
'
).
addClass
(
'
is-invalid
'
);
errorElements
.
push
(
'
#motherMobile
'
);
}
if
(
formData
.
get
(
'
motherImage
'
).
name
==
''
)
{
$
(
'
#motherImage
'
).
addClass
(
'
is-invalid
'
);
$
(
'
#motherImage
'
).
next
(
'
.la-invalid-feedback
'
).
html
(
'
For Marital Status Married, Please provide mother image
'
);
$
(
'
#motherImage
'
).
prev
(
'
label
'
).
addClass
(
'
is-invalid
'
);
errorElements
.
push
(
'
#motherImage
'
);
}
}
if
(
errorElements
.
length
>
0
)
{
$
(
'
html, body
'
).
animate
({
scrollTop
:
$
(
errorElements
[
0
]).
offset
().
top
-
100
},
200
);
return
null
;
}
return
null
;
}
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment