JezK
Edit File: form.js
jQuery(document).ready(function ($) { window.onload = function () { $(".bts-popup").delay(1000).addClass('is-visible'); } //open popup $('.bts-popup-trigger').on('click', function (event) { event.preventDefault(); $('.bts-popup').addClass('is-visible'); }); $("#select-year, #select-month, #select-day").change(function() { var selectedYear = $("#select-year").val(); var selectedMonth = $("#select-month").val(); var selectedDay = $("#select-day").val(); var selectedDate = new Date(selectedYear, selectedMonth, selectedDay); var formattedDate = selectedDate.getDate().toString().padStart(2, '0') + '-' + (selectedDate.getMonth() + 1).toString().padStart(2, '0') + '-' + selectedDate.getFullYear(); $('#dob').val(formattedDate); }); $('#regFrom').click(function() { jQuery("#submitBtn").show(); }); $('#submitBtn').click(function () { jQuery("#mainSubmit").show(); jQuery("#submitBtn").show(); var gradeAppliedform = $('#gradeApplied').val().toUpperCase(); if (gradeAppliedform == "") { var gradeAppliedselect = "This Field is Mandatory"; jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { var gradeAppliedselect = ''; if (gradeAppliedform == 'NURSERY' || gradeAppliedform == 'HKG' || gradeAppliedform == 'PG' || gradeAppliedform == 'LKG') { gradeAppliedselect = gradeAppliedform; } else if (gradeAppliedform == '1ST') { gradeAppliedselect = 1; } else if (gradeAppliedform == '2ND') { gradeAppliedselect = 2; } else if (gradeAppliedform == '3RD') { gradeAppliedselect = 3; } else if (gradeAppliedform == '4TH') { gradeAppliedselect = 4; } else if (gradeAppliedform == '5TH') { gradeAppliedselect = 5; } else if (gradeAppliedform == '6TH') { gradeAppliedselect = 6; } else if (gradeAppliedform == '7TH') { gradeAppliedselect = 7; } else if (gradeAppliedform == '8TH') { gradeAppliedselect = 8; } else if (gradeAppliedform == '9TH') { gradeAppliedselect = 9; } else if (gradeAppliedform == '11TH') { gradeAppliedselect = 11; } } var firstBranchPreferenceform = $('#firstBranchPreference').val(); if (firstBranchPreferenceform == "teolerHighSchool") { var firstBranchPreferencefullschool = "Teoler High School (Sirsi)"; } else if (firstBranchPreferenceform == "teolerPreSchool") { var firstBranchPreferencefullschool = "Teoler Pre School (Vaishali)"; } else if (firstBranchPreferenceform == "teolerUnbounded") { var firstBranchPreferencefullschool = "Teoler Unbounded (Sirsi)"; } else if (firstBranchPreferenceform == "teolerPreSchoolNirman") { var firstBranchPreferencefullschool = "Teoler Pre School (Nirman Nagar)"; } else if (firstBranchPreferenceform == "null") { var firstBranchPreferencefullschool = "This Field is Mandatory"; jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else if (firstBranchPreferenceform == "") { var firstBranchPreferencefullschool = "This Field is Mandatory"; jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } var secondBranchPreferenceform = $('#secondBranchPreference').val(); if (secondBranchPreferenceform == "teolerHighSchool") { var secondBranchPreferencefullschool = "Teoler High School (Sirsi)"; } else if (secondBranchPreferenceform == "teolerPreSchool") { var secondBranchPreferencefullschool = "Teoler Pre School (Vaishali)"; } else if (secondBranchPreferenceform == "teolerUnbounded") { var secondBranchPreferencefullschool = "Teoler Unbounded (Sirsi)"; } else if (secondBranchPreferenceform == "teolerPreSchoolNirman") { var secondBranchPreferencefullschool = "Teoler Pre School (Nirman Nagar)"; } else if (secondBranchPreferenceform == "null") { var secondBranchPreferencefullschool = ""; } else if (secondBranchPreferenceform == "") { var secondBranchPreferencefullschool = ""; } var thirdBranchPreferenceform = $('#thirdBranchPreference').val(); if (thirdBranchPreferenceform == "teolerHighSchool") { var thirdBranchPreferencefullschool = "Teoler High School (Sirsi)"; } else if (thirdBranchPreferenceform == "teolerPreSchool") { var thirdBranchPreferencefullschool = "Teoler Pre School (Vaishali)"; } else if (thirdBranchPreferenceform == "teolerUnbounded") { var thirdBranchPreferencefullschool = "Teoler Unbounded (Sirsi)"; } else if (thirdBranchPreferenceform == "teolerPreSchoolNirman") { var thirdBranchPreferencefullschool = "Teoler Pre School (Nirman Nagar)"; } else if (thirdBranchPreferenceform == "null") { var thirdBranchPreferencefullschool = ""; } else if (thirdBranchPreferenceform == "") { var thirdBranchPreferencefullschool = ""; } var fourthBranchPreferenceform = $('#fourthBranchPreference').val(); if (fourthBranchPreferenceform == "teolerHighSchool") { var fourthBranchPreferencefullschool = "Teoler High School (Sirsi)"; } else if (fourthBranchPreferenceform == "teolerPreSchool") { var fourthBranchPreferencefullschool = "Teoler Pre School (Vaishali)"; } else if (fourthBranchPreferenceform == "teolerUnbounded") { var fourthBranchPreferencefullschool = "Teoler Unbounded (Sirsi)"; } else if (fourthBranchPreferenceform == "teolerPreSchoolNirman") { var fourthBranchPreferencefullschool = "Teoler Pre School (Nirman Nagar)"; } else if (fourthBranchPreferenceform == "null") { var fourthBranchPreferencefullschool = ""; } else if (fourthBranchPreferenceform == "") { var fourthBranchPreferencefullschool = ""; } if (gradeAppliedform == '9TH' || gradeAppliedform == '11TH') { var subjectChosenform = $('#subjectChosen').val(); if (gradeAppliedform == '9TH') { if (firstBranchPreferenceform == 'teolerHighSchool') { if (subjectChosenform == "9th JEE Foundation ") { var subjectChosenformselect = "9th JEE Foundation "; } else if (subjectChosenform == "9th NEET Foundation") { var subjectChosenformselect = "9th NEET Foundation"; } else if (subjectChosenform == "9th IPMAT Foundation") { var subjectChosenformselect = "9th IPMAT Foundation"; } else if (subjectChosenform == "9th Regular") { var subjectChosenformselect = "9th Regular"; } } else { var subjectChosenformselect = ""; } } if (gradeAppliedform == '11TH') { if (subjectChosenform == "11th JEE Integrated Program") { var subjectChosenformselect = "11th JEE Integrated Program"; } else if (subjectChosenform == "11th NEET Integrated Program") { var subjectChosenformselect = "11th NEET Integrated Program"; } else if (subjectChosenform == "11th IPMAT/CLAT Integrated Program") { var subjectChosenformselect = "11th IPMAT/CLAT Integrated Program"; } else if (subjectChosenform == "11th PCM Regular") { var subjectChosenformselect = "11th PCM Regular"; } else if (subjectChosenform == "11th PCB Regular") { var subjectChosenformselect = "11th PCB Regular"; } else if (subjectChosenform == "11th Commerce") { var subjectChosenformselect = "11th Commerce"; } } } else { var subjectChosenformselect = ""; } if (gradeAppliedselect == 'This Field is Mandatory') { $('#gradeAppliedform').css('color', 'red'); $('#gradeAppliedform').text(gradeAppliedselect); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#gradeAppliedform').css('color', '#f09f1c'); $('#gradeAppliedform').text(gradeAppliedselect); } if (firstBranchPreferencefullschool == 'This Field is Mandatory') { $('#firstBranchPreferenceform').css('color', 'red'); $('#firstBranchPreferenceform').text(firstBranchPreferencefullschool); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#firstBranchPreferenceform').css('color', '#f09f1c'); $('#firstBranchPreferenceform').text(firstBranchPreferencefullschool); } $('#secondBranchPreferenceform').text(secondBranchPreferencefullschool); $('#thirdBranchPreferenceform').text(thirdBranchPreferencefullschool); $('#fourthBranchPreferenceform').text(fourthBranchPreferencefullschool); $('#subjectChosenform').text(subjectChosenformselect); var studentFirstNameselect = $('#studentFirstName').val().toUpperCase(); if (studentFirstNameselect == "") { var studentFirstName = "This Field is Mandatory"; jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { var studentFirstName = studentFirstNameselect; } var studentLastNameselect = $('#studentLastName').val().toUpperCase(); var dobselect = $('#dob').val(); if (dobselect == "") { var dob = "This Field is Mandatory"; jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { var dob = dobselect; } var addressselect = $('#address').val().toUpperCase(); if (addressselect == "") { var address = "This Field is Mandatory"; jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { var address = addressselect; } var emailselect = $('#email').val().toUpperCase(); if (emailselect == "") { var email = "This Field is Mandatory"; jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { var email = emailselect; } var mobileFatherselect = $('#mobileFather').val(); if (mobileFatherselect == "") { var mobileFather = "This Field is Mandatory"; jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { var mobileFather = mobileFatherselect; } var mobileMotherselect = $('#mobileMother').val(); if (mobileMotherselect == "") { var mobileMother = "This Field is Mandatory"; jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { var mobileMother = mobileMotherselect; } if (studentFirstName == 'This Field is Mandatory') { $('#fname').css('color', 'red'); $('#fname').text(studentFirstName); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#fname').css('color', '#f09f1c'); $('#fname').text(studentFirstName); } if (address == 'This Field is Mandatory') { $('#addressform').css('color', 'red'); $('#addressform').text(address); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#addressform').css('color', '#f09f1c'); $('#addressform').text(address); } if (email == 'This Field is Mandatory') { $('#emailform').css('color', 'red'); $('#emailform').text(email); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#emailform').css('color', '#f09f1c'); $('#emailform').text(email); } if (mobileFather == 'This Field is Mandatory') { $('#mobileFatherform').css('color', 'red'); $('#mobileFatherform').text(mobileFather); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#mobileFatherform').css('color', '#f09f1c'); $('#mobileFatherform').text(mobileFather); } if (mobileMother == 'This Field is Mandatory') { $('#mobileMotherform').css('color', 'red'); $('#mobileMotherform').text(mobileMother); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#mobileMotherform').css('color', '#f09f1c'); $('#mobileMotherform').text(mobileMother); } var fatherNameval = $('#fatherName').val(); if (fatherNameval == "") { var fatherName = "This Field is Mandatory"; $('#fatherNameform').css('color', 'red'); $('#fatherNameform').text(fatherName); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#fatherNameform').css('color', '#f09f1c'); $('#fatherNameform').text(fatherNameval.toUpperCase()); } var fatherOccupationval = $('#fatherOccupation').val(); if (fatherOccupationval == "") { var fatherOccupationform = "This Field is Mandatory"; $('#fatherOccupationform').css('color', 'red'); $('#fatherOccupationform').text(fatherOccupationform); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#fatherOccupationform').css('color', '#f09f1c'); $('#fatherOccupationform').text(fatherOccupationval.toUpperCase()); } var motherNameval = $('#motherName').val(); if (motherNameval == "") { var motherNameform = "This Field is Mandatory"; $('#motherNameform').css('color', 'red'); $('#motherNameform').text(motherNameform); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#motherNameform').css('color', '#f09f1c'); $('#motherNameform').text(motherNameval.toUpperCase()); } var motherOccupationval = $('#motherOccupation').val(); if (motherOccupationval == "") { var motherOccupationform = "This Field is Mandatory"; $('#motherOccupationform').css('color', 'red'); $('#motherOccupationform').text(motherOccupationform); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#motherOccupationform').css('color', '#f09f1c'); $('#motherOccupationform').text(motherOccupationval.toUpperCase()); } var fatherEmployer = $('#fatherEmployer').val(); if (fatherEmployer == "") { var fatherEmployerform = "This Field is Mandatory"; $('#fatherEmployerform').css('color', 'red'); $('#fatherEmployerform').text(fatherEmployerform); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#fatherEmployerform').css('color', '#f09f1c'); $('#fatherEmployerform').text(fatherEmployer.toUpperCase()); } var fatherEducation = $('#fatherEducation').val(); if (fatherEducation == "") { var fatherEducationform = "This Field is Mandatory"; $('#fatherEducationform').css('color', 'red'); $('#fatherEducationform').text(fatherEducationform); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#fatherEducationform').css('color', '#f09f1c'); $('#fatherEducationform').text(fatherEducation.toUpperCase()); } var fatherInstitute = $('#fatherInstitute').val(); if (fatherInstitute == "") { var fatherInstituteform = "This Field is Mandatory"; $('#fatherInstituteform').css('color', 'red'); $('#fatherInstituteform').text(fatherInstituteform); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#fatherInstituteform').css('color', '#f09f1c'); $('#fatherInstituteform').text(fatherInstitute.toUpperCase()); } var motherEducation = $('#motherEducation').val(); if (motherEducation == "") { var motherEducationform = "This Field is Mandatory"; $('#motherEducationform').css('color', 'red'); $('#motherEducationform').text(motherEducationform); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#motherEducationform').css('color', '#f09f1c'); $('#motherEducationform').text(motherEducation.toUpperCase()); } var motherInstitute = $('#motherInstitute').val(); if (motherInstitute == "") { var motherInstituteform = "This Field is Mandatory"; $('#motherInstituteform').css('color', 'red'); $('#motherInstituteform').text(motherInstituteform); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#motherInstituteform').css('color', '#f09f1c'); $('#motherInstituteform').text(motherInstitute.toUpperCase()); } var motherEmployer = $('#motherEmployer').val(); if (motherEmployer == "") { var motherEmployerform = "This Field is Mandatory"; $('#motherEmployerform').css('color', 'red'); $('#motherEmployerform').text(motherEmployerform); jQuery("#mainSubmit").hide(); jQuery("#submitBtn").hide(); } else { $('#motherEmployerform').css('color', '#f09f1c'); $('#motherEmployerform').text(motherEmployer.toUpperCase()); } $('#dateofbirth').text(dob); $('#lname').text(studentLastNameselect); $('#genderform').text($('input[name="gender"]:checked').val()); $('#languageSpokenform').text($('#languageSpoken').val().toUpperCase()); $('#cityform').text($('#city').val().toUpperCase()); $('#pinCodeform').text($('#pinCode').val()); $('#reg_phoneform').text($('#reg_phone').val()); // $('#fname').text($('#firstname').val()); $('#prevSchoolform').text($('#prevSchool').val().toUpperCase()); $('#prevSchoolFromYearform').text($('#prevSchoolFromYear').val().toUpperCase()); $('#prevSchoolToYearform').text($('#prevSchoolToYear').val().toUpperCase()); $('#leavingReasonform').text($('#leavingReason').val().toUpperCase()); var haveSiblingform = $('input[name="haveSibling"]:checked').val(); if (haveSiblingform == "Yes") { $("#siblingcontent").show(); } else if (haveSiblingform == "No") { $("#siblingcontent").hide(); } var siblingSchoolselect = $('#siblingSchool').val(); if (siblingSchoolselect == "null") { var siblingSchoolform = ""; } else if (siblingSchoolselect == "teolerHighSchool") { var siblingSchoolform = "Teoler High School (Sirsi)"; } else if (siblingSchoolselect == "teolerPreSchool") { var siblingSchoolform = "Teoler Pre School (Vaishali)"; } else if (siblingSchoolselect == "teolerUnbounded") { var siblingSchoolform = "Teoler Unbounded (Sirsi)"; } else if (siblingSchoolselect == "teolerPreSchoolNirman") { var siblingSchoolform = "Teoler Pre School (Nirman Nagar)"; } $('#siblingNameform').text($('#siblingName').val().toUpperCase()); $('#siblingGradeform').text($('#siblingGrade').val().toUpperCase()); $('#siblingAgeform').text($('#siblingAge').val().toUpperCase()); $('#siblingSchoolform').text(siblingSchoolform); $('#busFacilityform').text($('input[name="busFacility"]:checked').val()); }); }); function isEmail(email) { return /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(email); } $(function () { $("#dob").datepicker({ changeMonth: true, changeYear: true, yearRange: "-20: +0", dateFormat: "dd-mm-yy", onSelect: function () { var event; if (typeof window.Event == "function") { event = new Event('change'); this.dispatchEvent(event); } else { event = document.createEvent('HTMLEvents'); event.initEvent('change', false, false); this.dispatchEvent(event); } } }); }); function validateDOB() { var dobValue = document.getElementById('dob').value.replace(/-/g, "/"); // var dobString = this.value.replace(/-/g, "/"); var gradeValue = document.getElementById('gradeApplied').value; var dobObject = new Date(dobValue); var isDobValidated; switch (gradeValue) { case "pg": //Case for PG - Play Group var minDate = new Date('10/01/2018'); var maxDate = new Date('03/30/2019'); if (dobObject.getTime() >= minDate.getTime() && dobObject.getTime() <= maxDate.getTime()) { isDobValidated = true; } else { alert('Date of Birth is not in the required period according to the grade selected !!'); isDobValidated = false; } break; case "nursery": //Case for nursery var minDate = new Date('10/01/2017'); var maxDate = new Date('09/30/2018'); if (dobObject.getTime() >= minDate.getTime() && dobObject.getTime() <= maxDate.getTime()) { isDobValidated = true; } else { alert('Date of Birth is not in the required period according to the grade selected !!'); isDobValidated = false; } break; case "lkg": //Case for lkg var minDate = new Date('10/01/2016'); var maxDate = new Date('09/30/2017'); if (dobObject.getTime() >= minDate.getTime() && dobObject.getTime() <= maxDate.getTime()) { isDobValidated = true; } else { alert('Date of Birth is not in the required period according to the grade selected !!'); isDobValidated = false; } break; case "hkg": //Case for hkg var minDate = new Date('10/01/2015'); var maxDate = new Date('09/30/2016'); if (dobObject.getTime() >= minDate.getTime() && dobObject.getTime() <= maxDate.getTime()) { isDobValidated = true; } else { alert('Date of Birth is not in the required period according to the grade selected !!'); isDobValidated = false; } break; case "1st": //Case for 1st var minDate = new Date('10/01/2014'); var maxDate = new Date('09/30/2015'); if (dobObject.getTime() >= minDate.getTime() && dobObject.getTime() <= maxDate.getTime()) { isDobValidated = true; } else { alert('Date of Birth is not in the required period according to the grade selected !!'); isDobValidated = false; } break; default: console.log("Default Case"); } return isDobValidated; } //Display Sibling Form Fieds based on haveSibling input function getValue(x) { if (x.value == 'No') { document.getElementById("sibling-info-fields").style.display = 'none'; // you need a identifier for changes $('#siblingName,#siblingGrade,#siblingSchool,#siblingAge').removeAttr('required'); $('#siblingName,#siblingGrade,#siblingSchool,#siblingAge').val(""); } else { document.getElementById("sibling-info-fields").style.display = 'block'; // you need a identifier for changes $("#siblingName,#siblingGrade,#siblingSchool,#siblingAge").prop('required', true); } } function addHighSchoolOptionTo3divs() { // Check if select has an option in it if ($("#firstBranchPreference option[value='teolerHighSchool']").length === 0) { $("#firstBranchPreference").append('<option value="teolerHighSchool">Teoler High School (Sirsi)</option>'); } // Check if select has an option in it if ($("#secondBranchPreference option[value='teolerHighSchool']").length === 0) { $("#secondBranchPreference").append('<option value="teolerHighSchool">Teoler High School (Sirsi)</option>'); } // Check if select has an option in it if ($("#thirdBranchPreference option[value='teolerHighSchool']").length === 0) { $("#thirdBranchPreference").append('<option value="teolerHighSchool">Teoler High School (Sirsi)</option>'); } // Check if select has an option in it if ($("#fourthBranchPreference option[value='teolerHighSchool']").length === 0) { $("#fourthBranchPreference").append('<option value="teolerHighSchool">Teoler High School (Sirsi)</option>'); } } function addPreSchoolOptionTo2divs() { // Check if select has an option in it if ($("#firstBranchPreference option[value='teolerPreSchool']").length === 0) { $("#firstBranchPreference").append('<option value="teolerPreSchool">Teoler Pre School (Vaishali)</option>'); } // Check if select has an option in it if ($("#secondBranchPreference option[value='teolerPreSchool']").length === 0) { $("#secondBranchPreference").append('<option value="teolerPreSchool">Teoler Pre School (Vaishali)</option>'); } if ($("#thirdBranchPreference option[value='teolerPreSchool']").length === 0) { $("#thirdBranchPreference").append('<option value="teolerPreSchool">Teoler Pre School (Vaishali)</option>'); } if ($("#fourthBranchPreference option[value='teolerPreSchool']").length === 0) { $("#fourthBranchPreference").append('<option value="teolerPreSchool">Teoler Pre School (Vaishali)</option>'); } } function addHighSchoolOptionTo2divs() { // Check if select has an option in it if ($("#firstBranchPreference option[value='teolerHighSchool']").length === 0) { $("#firstBranchPreference").append('<option value="teolerHighSchool">Teoler High School (Sirsi)</option>'); } // Check if select has an option in it if ($("#secondBranchPreference option[value='teolerHighSchool']").length === 0) { $("#secondBranchPreference").append('<option value="teolerHighSchool">Teoler High School (Sirsi)</option>'); } // Check if select has an option in it if ($("#thirdBranchPreference option[value='teolerHighSchool']").length === 0) { $("#thirdBranchPreference").append('<option value="teolerHighSchool">Teoler High School (Sirsi)</option>'); } // Check if select has an option in it if ($("#fourthBranchPreference option[value='teolerHighSchool']").length === 0) { $("#fourthBranchPreference").append('<option value="teolerHighSchool">Teoler High School (Sirsi)</option>'); } } function addUnboundedOptionTo2divs() { // Check if select has an option in it if ($("#firstBranchPreference option[value='teolerUnbounded']").length === 0) { $("#firstBranchPreference").append('<option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); } // Check if select has an option in it if ($("#secondBranchPreference option[value='teolerUnbounded']").length === 0) { $("#secondBranchPreference").append('<option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); } // Check if select has an option in it if ($("#thirdBranchPreference option[value='teolerUnbounded']").length === 0) { $("#thirdBranchPreference").append('<option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); } // Check if select has an option in it if ($("#fourthBranchPreference option[value='teolerUnbounded']").length === 0) { $("#fourthBranchPreference").append('<option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); } } function removePreSchoolOptionFrom2divs() { if ($("#firstBranchPreference option[value='teolerPreSchool']").length > 0) { $("#firstBranchPreference option[value='teolerPreSchool']").remove(); } if ($("#secondBranchPreference option[value='teolerPreSchool']").length > 0) { $("#secondBranchPreference option[value='teolerPreSchool']").remove(); } if ($("#thirdBranchPreference option[value='teolerPreSchool']").length > 0) { $("#thirdBranchPreference option[value='teolerPreSchool']").remove(); } if ($("#fourthBranchPreference option[value='teolerPreSchool']").length > 0) { $("#fourthBranchPreference option[value='teolerPreSchool']").remove(); } } function removeHighSchoolOptionFrom2divs() { if ($("#firstBranchPreference option[value='teolerHighSchool']").length > 0) { $("#firstBranchPreference option[value='teolerHighSchool']").remove(); } if ($("#secondBranchPreference option[value='teolerHighSchool']").length > 0) { $("#secondBranchPreference option[value='teolerHighSchool']").remove(); } if ($("#thirdBranchPreference option[value='teolerHighSchool']").length > 0) { $("#thirdBranchPreference option[value='teolerHighSchool']").remove(); } if ($("#fourthBranchPreference option[value='teolerHighSchool']").length > 0) { $("#fourthBranchPreference option[value='teolerHighSchool']").remove(); } } function removePreSchoolAndUnboundedFrom1divAndAddHighSchool() { if ($("#firstBranchPreference option[value='teolerPreSchool']").length > 0) { $("#firstBranchPreference option[value='teolerPreSchool']").remove(); } if ($("#firstBranchPreference option[value='teolerUnbounded']").length > 0) { $("#firstBranchPreference option[value='teolerUnbounded']").remove(); } if ($("#firstBranchPreference option[value='teolerHighSchool']").length === 0) { $("#firstBranchPreference").append('<option value="teolerHighSchool">Teoler High School (Sirsi)</option>'); } } function removePreSchoolAndHighSchoolFrom1divAndAddUnbounded() { if ($("#firstBranchPreference option[value='teolerPreSchool']").length > 0) { $("#firstBranchPreference option[value='teolerPreSchool']").remove(); } if ($("#firstBranchPreference option[value='teolerHighSchool']").length > 0) { $("#firstBranchPreference option[value='teolerHighSchool']").remove(); } if ($("#firstBranchPreference option[value='teolerUnbounded']").length === 0) { $("#firstBranchPreference").append('<option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); } } $('#assessmenttype').on('change', function () { var selected = $(this).val(); switch (selected) { case "offline": // $('.dateSelectDiv').css('display', 'flex'); $('.offline-test-msg').css('display', 'block'); $('.online-test-msg').css('display', 'none'); break; case "online": // $('.dateSelectDiv').css('display', 'none'); $('.offline-test-msg').css('display', 'none'); $('.online-test-msg').css('display', 'block'); break; } }); $('.branchPreference').on('change', function() { // Get the values selected in each select element const selectedValues = $('.branchPreference').map(function() { return $(this).val(); }).get(); // Iterate over each select element to update options $('.branchPreference').each(function(index) { const $select = $(this); // Show all options first $select.find('option').show(); // Hide options that are selected in other selects selectedValues.forEach((value, idx) => { if (value && idx !== index) { $select.find(`option[value="${value}"]`).hide(); } }); }); }); $("#firstBranchPreference").on("change", function () { var firstBranchPreferenceform = $(this).val(); var gradeApplied = $('#gradeApplied').val(); if ( ( gradeApplied == "1st" || gradeApplied == "2nd" || gradeApplied == "3rd" || gradeApplied == "4th" || gradeApplied == "5th" || gradeApplied == "6th" || gradeApplied == "7th" || gradeApplied == "8th" || gradeApplied == "9th" ) && firstBranchPreferenceform == "teolerHighSchool") { $("#assessmenttype").html('<option value="offline" selected>Offline assessment/interaction (Fee for this mode is INR 300/-)</option>'); } $("#secondBranchPreference option").prop('disabled', false); $("#thirdBranchPreference option").prop('disabled', false); $("#fourthBranchPreference option").prop('disabled', false); if(this.value != "notApplicable") { $("#secondBranchPreference option[value='" + this.value + "']").prop('disabled', true); $("#thirdBranchPreference option[value='" + this.value + "']").prop('disabled', true); $("#fourthBranchPreference option[value='" + this.value + "']").prop('disabled', true); } }); $("#secondBranchPreference").on("change", function () { $("#thirdBranchPreference option").prop('disabled', false); $("#fourthBranchPreference option").prop('disabled', false); if (this.value != 'notApplicable') { $("#thirdBranchPreference option[value='" + this.value + "']").prop('disabled', true); $("#fourthBranchPreference option[value='" + this.value + "']").prop('disabled', true); } var firstBranch = $('#firstBranchPreference').find(":selected").val(); if(firstBranch != "notApplicable") { $("#thirdBranchPreference option[value='" + firstBranch + "']").prop('disabled', true); $("#fourthBranchPreference option[value='" + firstBranch + "']").prop('disabled', true); } $("#secondBranchPreference option[value='notApplicable']").prop('disabled', false); $("#thirdBranchPreference option[value='notApplicable']").prop('disabled', false); $("#fourthBranchPreference option[value='notApplicable']").prop('disabled', false); }); $("#thirdBranchPreference").on("change", function () { $("#fourthBranchPreference option").prop('disabled', false); if (this.value != 'notApplicable') { $("#fourthBranchPreference option[value='" + this.value + "']").prop('disabled', true); } var firstBranch = $('#firstBranchPreference').find(":selected").val(); if(firstBranch != "notApplicable") { $("#fourthBranchPreference option[value='" + firstBranch + "']").prop('disabled', true); } var secondBranch = $('#secondBranchPreference').find(":selected").val(); if(secondBranch != "notApplicable") { $("#fourthBranchPreference option[value='" + secondBranch + "']").prop('disabled', true); } $("#secondBranchPreference option[value='notApplicable']").prop('disabled', false); $("#thirdBranchPreference option[value='notApplicable']").prop('disabled', false); $("#fourthBranchPreference option[value='notApplicable']").prop('disabled', false); }); $('#gradeApplied').on('change', function () { var selection = $(this).val(); switch (selection) { case "pg": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler Unbounded (Sirsi)</td><td>20 seats</td></tr>"); jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#seatnotavailability").show(); $(".firstBranchPreference").hide(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'none'); $("#nextButtonHide").show(); $("#firstBranchPreference").html('<option value="">Select Preference</option>'); $("#secondBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); $("#thirdBranchPreference").html(''); $("#fourthBranchPreference").html(''); break; case "nursery": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler Pre School (Nirman Nagar)</td><td>10 seats</td></tr>"); // jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#firstBranchPreference").show(); $("#seatnotavailability").show(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'none'); $("#nextButtonHide").show(); $("#firstBranchPreference").html('<option value="">Select Preference</option><option value="teolerPreSchoolNirman">Teoler Pre School (Nirman Nagar)</option>'); $("#secondBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="teolerPreSchoolNirman">Teoler Pre School (Nirman Nagar)</option><option value="notApplicable">Not Applicable</option>'); $("#thirdBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="teolerPreSchoolNirman">Teoler Pre School (Nirman Nagar)</option><option value="notApplicable">Not Applicable</option>'); $("#fourthBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="teolerPreSchoolNirman">Teoler Pre School (Nirman Nagar)</option><option value="notApplicable">Not Applicable</option>'); break; case "lkg": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler Pre School (Nirman Nagar)</td><td>2 seats</td></tr>"); jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#firstBranchPreference").hide(); $("#seatnotavailability").show(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'none'); $("#nextButtonHide").show(); //$('#assessmentTypeDiv').css('display', 'none'); // $("#firstBranchPreference").html('<option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); $("#firstBranchPreference").html('<option value="">Select Preference</option><option value="teolerPreSchoolNirman">Teoler Pre School (Nirman Nagar)</option>'); $("#secondBranchPreference").html('<option value="">Select Preference</option><option value="teolerPreSchool">Teoler Pre School (Vaishali)</option><option value="teolerPreSchoolNirman">Teoler Pre School (Nirman Nagar)</option><option value="notApplicable">Not Applicable</option>'); $("#thirdBranchPreference").html(''); $("#fourthBranchPreference").html(''); break; case "hkg": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler Pre School (Nirman Nagar)</td><td>2 seats</td></tr>"); jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#firstBranchPreference").hide(); $("#seatnotavailability").show(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'none'); $("#nextButtonHide").show(); //$('#assessmentTypeDiv').css('display', 'none'); $("#firstBranchPreference").html('<option value="">Select Preference</option><option value="teolerPreSchoolNirman">Teoler Pre School (Nirman Nagar)</option>'); $("#secondBranchPreference").html('<option value="">Select Preference</option><option value="teolerPreSchool">Teoler Pre School (Vaishali)</option><option value="teolerPreSchoolNirman">Teoler Pre School (Nirman Nagar)</option><option value="notApplicable">Not Applicable</option>'); $("#thirdBranchPreference").html(''); $("#fourthBranchPreference").html(''); break; case "1st": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler Unbounded (Sirsi)</td><td>4 seats</td></tr>"); jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#firstBranchPreference").hide(); $("#seatnotavailability").show(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'none'); $("#nextButtonHide").show(); //$('#assessmentTypeDiv').css('display', 'none'); $("#firstBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); $("#secondBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="teolerPreSchoolNirman">Teoler Pre School (Nirman Nagar)</option><option value="notApplicable">Not Applicable</option>'); $("#thirdBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="teolerPreSchoolNirman">Teoler Pre School (Nirman Nagar)</option><option value="notApplicable">Not Applicable</option>'); $("#fourthBranchPreference").html(''); break; case "2nd": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler Unbounded (Sirsi)</td><td>10 seats</td></tr><tr><td>Teoler Pre School (Nirman Nagar)</td><td>5 seats</td></tr>"); jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#firstBranchPreference").hide(); $("#seatnotavailability").show(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'none'); $("#nextButtonHide").show(); //$('#assessmentTypeDiv').css('display', 'none'); $("#firstBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="teolerPreSchoolNirman">Teoler Pre School (Nirman Nagar)</option>'); $("#secondBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="teolerPreSchoolNirman">Teoler Pre School (Nirman Nagar)</option><option value="notApplicable">Not Applicable</option>'); $("#thirdBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="teolerPreSchoolNirman">Teoler Pre School (Nirman Nagar)</option><option value="notApplicable">Not Applicable</option>'); $("#fourthBranchPreference").html(''); break; case "3rd": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler Unbounded (Sirsi)</td><td>2 seats</td></tr>"); jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#seatnotavailability").show(); $("#firstBranchPreference").hide(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'none'); $("#nextButtonHide").show(); //$('#assessmentTypeDiv').css('display', 'none'); $("#firstBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); $("#secondBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="notApplicable">Not Applicable</option>'); $("#thirdBranchPreference").html(''); $("#fourthBranchPreference").html(''); break; case "4th": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler Unbounded (Sirsi)</td><td>10 seats</td></tr>"); jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#firstBranchPreference").hide(); $("#seatnotavailability").show(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'none'); $("#nextButtonHide").show(); //$('#assessmentTypeDiv').css('display', 'none'); $("#firstBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); $("#secondBranchPreference").html('<option value="">Select Preference</option><option value="teolerHighSchool">Teoler High School (Sirsi)</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="notApplicable">Not Applicable</option>'); $("#thirdBranchPreference").html(''); $("#fourthBranchPreference").html(''); break; case "5th": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler Unbounded (Sirsi)</td><td>2 seats</td></tr>"); jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#seatnotavailability").show(); $("#firstBranchPreference").hide(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'none'); $("#nextButtonHide").show(); //$('#assessmentTypeDiv').css('display', 'none'); $("#firstBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); $("#secondBranchPreference").html('<option value="">Select Preference</option><option value="teolerHighSchool">Teoler High School (Sirsi)</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="notApplicable">Not Applicable</option>'); $("#thirdBranchPreference").html(''); $("#fourthBranchPreference").html(''); break; case "6th": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler Unbounded (Sirsi)</td><td>2 seats</td></tr>"); jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#seatnotavailability").show(); $("#firstBranchPreference").hide(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'none'); $("#nextButtonHide").show(); //$('#assessmentTypeDiv').css('display', 'flex'); $("#firstBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); $("#secondBranchPreference").html('<option value="">Select Preference</option><option value="teolerHighSchool">Teoler High School (Sirsi)</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="notApplicable">Not Applicable</option>'); $("#thirdBranchPreference").html(''); $("#fourthBranchPreference").html(''); break; case "7th": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler Unbounded (Sirsi)</td><td>2 seats</td></tr>"); jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#seatnotavailability").show(); $("#firstBranchPreference").hide(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'none'); $("#nextButtonHide").show(); //$('#assessmentTypeDiv').css('display', 'flex'); $("#firstBranchPreference").html('<option value="">Select Preference</option>'); $("#secondBranchPreference").html('<option value="">Select Preference</option><option value="teolerHighSchool">Teoler High School (Sirsi)</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="notApplicable">Not Applicable</option>'); $("#thirdBranchPreference").html(''); $("#fourthBranchPreference").html(''); break; case "8th": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler Unbounded (Sirsi)</td><td>3 seats</td></tr>"); jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#seatnotavailability").show(); $("#firstBranchPreference").hide(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'none'); $("#nextButtonHide").show(); //$('#assessmentTypeDiv').css('display', 'flex'); $("#firstBranchPreference").html('<option value="">Select Preference</option>'); $("#secondBranchPreference").html(''); $("#thirdBranchPreference").html(''); $("#fourthBranchPreference").html(''); break; case "9th": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler Unbounded (Sirsi)</td><td>10 seats Available</td></tr>"); jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#seatnotavailability").show(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'none'); $("#nextButtonHide").show(); //$('#assessmentTypeDiv').css('display', 'flex'); //$("#firstBranchPreference").html('<option value="">Select Preference</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); $("#firstBranchPreference").html('<option value="">Select Preference</option>'); //$("#secondBranchPreference").html('<option value="">Select Preference</option><option value="teolerHighSchool">Teoler High School (Sirsi)</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="notApplicable">Not Applicable</option>'); $("#thirdBranchPreference").html(''); $("#fourthBranchPreference").html(''); break; case "10th": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler High School (Sirsi)</td><td>0 seats</td></tr>"); jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#seatnotavailability").show(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'none'); $("#nextButtonHide").show(); //$('#assessmentTypeDiv').css('display', 'flex'); $("#firstBranchPreference").html('<option value="">Select Preference</option><option value="teolerHighSchool">Teoler High School (Sirsi)</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); $("#secondBranchPreference").html('<option value="">Select Preference</option><option value="teolerHighSchool">Teoler High School (Sirsi)</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="notApplicable">Not Applicable</option>'); $("#thirdBranchPreference").html(''); $("#fourthBranchPreference").html(''); break; case "11th": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler High School (Sirsi)</td><td>Open</td></tr>"); //jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#seatnotavailability").show(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $('#subjectChosenDiv').css('display', 'flex'); $("#nextButtonHide").show(); //$('#assessmentTypeDiv').css('display', 'flex'); $("#subjectChosen").html('<option value="11th JEE Integrated Program">11th JEE Integrated Program</option><option value="11th NEET Integrated Program">11th NEET Integrated Program</option><option value="11th IPMAT/CLAT Integrated Program">11th IPMAT/CLAT Integrated Program </option><option value="11th PCM Regular">11th PCM Regular</option><option value="11th Commerce">11th Commerce</option>'); // $("#subjectChosen").html('<option value="11th NEET Integrated Program">11th NEET Integrated Program</option>'); $("#firstBranchPreference").html('<option value="">Select Preference</option><option value="teolerHighSchool">Teoler High School (Sirsi)</option><option value="notApplicable">Not Applicable</option>'); $("#secondBranchPreference").html(''); $("#thirdBranchPreference").html(''); $("#fourthBranchPreference").html(''); break; case "12th": jQuery("#seat_availability_table").html("<tr><th>School</th><th>Seats</th></tr><tr><td>Teoler High School (Sirsi)</td><td>0 seats</td></tr>"); jQuery("#seat_availability_table").html("No Seats Available."); openPopup(); $("#seatnotavailability").show(); $(".secondBranchDiv").hide(); $(".thirdBranchDiv").hide(); $(".fourthBranchDiv").hide(); $("#nextButtonHide").show(); $('#subjectChosenDiv').css('display', 'flex'); $("#subjectChosen").html('<option value="XII_Commerce">12th Commerce</option><option value="XII_Science_PCM">12th Science (PCM)</option><option value="XII_Science_PCB">12th Science (PCB)</option>'); //$('#assessmentTypeDiv').css('display', 'flex'); $("#firstBranchPreference").html('<option value="">Select Preference</option><option value="teolerHighSchool">Teoler High School (Sirsi)</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option>'); $("#secondBranchPreference").html('<option value="">Select Preference</option><option value="teolerHighSchool">Teoler High School (Sirsi)</option><option value="teolerUnbounded">Teoler Unbounded (Sirsi)</option><option value="notApplicable">Not Applicable</option>'); $("#thirdBranchPreference").html(''); $("#fourthBranchPreference").html(''); break; default: $("#otherType").hide() } }); $('#subjectChosen').on('change', function () { var subjectValue = $(this).val(); if (subjectValue == "11th JEE Integrated Program" || subjectValue == "11th NEET Integrated Program" || subjectValue == "11th IPMAT/CLAT Integrated Program" || subjectValue == "11th PCM Regular" || subjectValue == "11th PCB Regular" || subjectValue == "11th PCB Regular" || subjectValue == "11th Commerce") { $("#assessmenttype").html('<option value="offline" selected>Offline assessment/interaction (Fee for this mode is INR 300/-)</option><option value="online">Online Assessment (Fee for this mode is INR 2000/-)</option>'); } else { $("#assessmenttype").html('<option value="offline" selected>Offline assessment/interaction (Fee for this mode is INR 300/-)</option>'); } }); $('#gradeApplied').on('change', function () { var gradeApplied = $(this).val(); if (gradeApplied == "pg" || gradeApplied == "nursery" || gradeApplied == "lkg" || gradeApplied == "hkg" || gradeApplied == "1st") { $("#assessmenttype").html('<option value="offline" selected>Offline assessment/interaction (Fee for this mode is INR 300/-)</option>'); } else { $("#assessmenttype").html('<option value="offline" selected>Offline assessment/interaction (Fee for this mode is INR 300/-)</option> <option value="online">Online Assessment (Fee for this mode is INR 2000/-)</option>'); } }); $('#firstBranchPreference').on('change', function () { var firstBranchPreference = $(this).val(); var gradeAppliedform = $('#gradeApplied').val(); if (gradeAppliedform == '9th') { if (firstBranchPreference == 'teolerHighSchool') { $('#subjectChosenDiv').css('display', 'flex'); $("#subjectChosen").html('<option value="9th JEE Foundation ">9th JEE Foundation </option><option value="9th NEET Foundation">9th NEET Foundation</option><option value="9th IPMAT Foundation">9th IPMAT Foundation</option><option value="9th Regular">9th Regular</option>'); } else { $('#subjectChosenDiv').css('display', 'none'); } } }); var daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], today = new Date(), // default targetDate is christmas targetDate = new Date(today.getFullYear(), 0, 1); setDate(targetDate); setYears(19) // set the next five years in dropdown $("#select-month").change(function () { var monthIndex = $("#select-month").val(); setDays(monthIndex); }); function setDate(date) { setDays(date.getMonth()); $("#select-day").val(date.getDate()); $("#select-month").val(date.getMonth()); $("#select-year").val(date.getFullYear()); } // make sure the number of days correspond with the selected month function setDays(monthIndex) { var optionCount = $('#select-day option').length, daysCount = daysInMonth[monthIndex]; if (optionCount < daysCount) { for (var i = optionCount; i < daysCount; i++) { $('#select-day') .append($("<option></option>") .attr("value", i + 1) .text(i + 1)); } } else { for (var i = daysCount; i < optionCount; i++) { var optionItem = '#select-day option[value=' + (i + 1) + ']'; $(optionItem).remove(); } } } function setYears(val) { // var year = today.getFullYear(); var year = 2005; for (var i = 0; i < val; i++) { $('#select-year') .append($("<option></option>") .attr("value", year + i) .text(year + i)); } } function validateForm() { var gradeApplied = $("#gradeApplied").val(); var studentLastName = $("#studentLastName").val(); var studentFirstName = $("#studentFirstName").val(); var firstBranchPreference = $("#firstBranchPreference").val(); var gender = $("#gender").val(); var email = $("#email").val(); var address = $("#address").val(); var dob = $("#dob").val(); var fatherName = $("#fatherName").val(); var fatherEducation = $("#fatherEducation").val(); var fatherEmployer = $("#fatherEmployer").val(); var fatherInstitute = $("#fatherInstitute").val(); var fatherOccupation = $("#fatherOccupation").val(); var motherEmployer = $("#motherEmployer").val(); var mobileFather = $("#mobileFather").val(); var motherInstitute = $("#motherInstitute").val(); var motherEducation = $("#motherEducation").val(); var motherName = $("#motherName").val(); var motherOccupation = $("#motherOccupation").val(); var mobileMother = $("#mobileMother").val(); var assessmenttype = $("#assessmenttype").val(); if (gradeApplied === "" || studentLastName === "" || studentFirstName === "" || firstBranchPreference === "" || gender === "" || email === "" || address === "" || dob === "" || fatherName === "" || fatherEducation === "" || fatherEmployer === "" || fatherInstitute === "" || mobileFather === "" || fatherOccupation === "" || motherEmployer === "" || motherInstitute === "" || motherEducation === "" || motherName === "" || motherOccupation === "" || mobileMother === "" || assessmenttype === "") { alert("Please fill all Mandatory fields."); return false; // Prevents form submission } else if (!isValidEmail(email)) { alert("Invalid email address"); return false; // Prevents form submission } else if (!isValidMobileNumber(mobileFather)) { alert("Father : Invalid mobile number"); return false; // Prevents form submission } else if (!isValidMobileNumber(mobileMother)) { alert("Mother : Invalid mobile number"); return false; // Prevents form submission } else { return true; } function isValidEmail(email) { return /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(email); } function isValidMobileNumber(mobileNumber) { // Regular expression to validate mobile number format const mobileRegex = /^([0|\+[0-9]{1,5})?([6-9][0-9]{9})$/; // Length validation const minLength = 10; // for example, minimum length const maxLength = 10; // for example, maximum length return mobileRegex.test(mobileNumber) && mobileNumber.length >= minLength && mobileNumber.length <= maxLength; } } // Function to open the popup function openPopup() { document.getElementById('seat_available_popup').style.display = 'flex'; } // Function to close the popup function closePopup() { document.getElementById('seat_available_popup').style.display = 'none'; } // Select elements const otpInput = document.getElementById('otp'); const resendBtn = document.getElementById('resendBtn'); const timerElem = document.getElementById('timer'); const errorMessage = document.getElementById('error-message'); // Timer and resend OTP function let countdown; let timeLeft = 180; // 2 minutes in seconds // Start timer countdown function startTimer() { countdown = setInterval(() => { let minutes = Math.floor(timeLeft / 60); let seconds = timeLeft % 60; timerElem.textContent = `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`; if (timeLeft <= 0) { clearInterval(countdown); resendBtn.disabled = false; errorMessage.textContent = "You can now resend the OTP."; } else { timeLeft--; } }, 1000); } // Resend OTP function (simulate OTP resend) function resendOTP() { // Simulate OTP resend action (You would typically send a request to the backend here) alert("OTP has been resent."); // Reset the timer and restart it timeLeft = 120; // Reset to 2 minutes resendBtn.disabled = true; errorMessage.textContent = ""; startTimer(); } // Event listener for the resend OTP button resendBtn.addEventListener('click', resendOTP); // Initially start the timer when the page loads startTimer();