Compare commits
90 Commits
e7b1fa5cc0
...
a41e9edbc7
| Author | SHA1 | Date |
|---|---|---|
|
|
a41e9edbc7 | |
|
|
af2dc7d3be | |
|
|
eb2ae72d11 | |
|
|
41ec4d5e22 | |
|
|
1b01354f3c | |
|
|
668094b45b | |
|
|
70d8a1efdb | |
|
|
6a0838d831 | |
|
|
473d8064e3 | |
|
|
46aab08cd0 | |
|
|
c3a3586ae9 | |
|
|
51e15cc5f7 | |
|
|
37c6c453c0 | |
|
|
4b67056345 | |
|
|
abab87969f | |
|
|
aa1bf0f472 | |
|
|
5b22baa49e | |
|
|
6a68e292d8 | |
|
|
02f2e176f4 | |
|
|
12a0fa7fb9 | |
|
|
cf3e9ea581 | |
|
|
030fadae22 | |
|
|
280b78b94c | |
|
|
7ff638abee | |
|
|
9566f100c6 | |
|
|
952697f032 | |
|
|
2a871f703b | |
|
|
f89d29c5e8 | |
|
|
9c29bcdfc8 | |
|
|
c7d3cb67be | |
|
|
ed50b19040 | |
|
|
16ab865b81 | |
|
|
3f93e7e52a | |
|
|
f11029e564 | |
|
|
bb57fa297d | |
|
|
41de15f7b4 | |
|
|
c5993ebadb | |
|
|
ea3ad8cc2d | |
|
|
ba9b32edd2 | |
|
|
c10a1a3891 | |
|
|
a1cdcfca86 | |
|
|
1935839edf | |
|
|
7204cf00e6 | |
|
|
21208f621a | |
|
|
113f8cde47 | |
|
|
875d26ee23 | |
|
|
ecfde794f9 | |
|
|
0804c5492a | |
|
|
0a58c939a8 | |
|
|
de8850366c | |
|
|
b015800fb5 | |
|
|
79faa04039 | |
|
|
97bbe62379 | |
|
|
449f2ba0f6 | |
|
|
55620d4097 | |
|
|
76be6e7514 | |
|
|
0e253239d1 | |
|
|
7dab393a78 | |
|
|
9f6399e46c | |
|
|
bc88ce335b | |
|
|
a772d4651a | |
|
|
8e732eb15e | |
|
|
846894f9dd | |
|
|
1a6fd3cf23 | |
|
|
c291892b46 | |
|
|
3b3ec46bd5 | |
|
|
1c9c46f483 | |
|
|
8a693f4441 | |
|
|
a29959a790 | |
|
|
a4f633ece9 | |
|
|
214c0b30f2 | |
|
|
a89dd2511f | |
|
|
9899cff15c | |
|
|
270fdeb54e | |
|
|
59193b105f | |
|
|
f523f992c6 | |
|
|
6379ed942d | |
|
|
a64bb9e224 | |
|
|
f06277fbae | |
|
|
6b2b54fe5e | |
|
|
9b614aae0c | |
|
|
f48abb61ea | |
|
|
ff926b8550 | |
|
|
4252c9757d | |
|
|
6d363ffe2a | |
|
|
41a97b1d44 | |
|
|
223c723729 | |
|
|
e32bde4f7b | |
|
|
be9694eea0 | |
|
|
2079cea434 |
|
|
@ -1836,13 +1836,6 @@
|
|||
// Next button logic
|
||||
nextButtons.forEach(button => {
|
||||
button.addEventListener("click", function () {
|
||||
if (currentStep === 0) {
|
||||
// Validate employer history fields before proceeding
|
||||
if (!validateEmployerHistory()) {
|
||||
return false; // Stop navigation
|
||||
}
|
||||
}
|
||||
|
||||
if (validateStep(currentStep)) {
|
||||
if (currentStep < steps.length - 1) {
|
||||
currentStep++;
|
||||
|
|
@ -1851,181 +1844,6 @@
|
|||
}
|
||||
});
|
||||
});
|
||||
function validateEmployerHistory() {
|
||||
const employerTable = document.getElementById('previous_employer_table_body');
|
||||
const rows = employerTable.querySelectorAll('tr');
|
||||
let hasErrors = false;
|
||||
|
||||
rows.forEach(row => {
|
||||
// Get the cells for this row
|
||||
const companyNameInput = row.querySelector('input[name="company_name"]');
|
||||
const designationInput = row.querySelector('input[name="designation"]');
|
||||
const dojInput = row.querySelector('input[name="doj"]');
|
||||
|
||||
// Check if ANY field in this row has a value
|
||||
const hasValues = Array.from(row.querySelectorAll('input')).some(input =>
|
||||
input.value && input.value.trim() !== ''
|
||||
);
|
||||
|
||||
if (hasValues) {
|
||||
// If any field has value, check required fields
|
||||
if (!companyNameInput || !companyNameInput.value.trim()) {
|
||||
companyNameInput.classList.add("is-invalid");
|
||||
companyNameInput.required = true;
|
||||
hasErrors = true;
|
||||
} else {
|
||||
companyNameInput.classList.remove("is-invalid");
|
||||
}
|
||||
|
||||
if (!designationInput || !designationInput.value.trim()) {
|
||||
if (designationInput) {
|
||||
designationInput.classList.add("is-invalid");
|
||||
designationInput.required = true;
|
||||
hasErrors = true;
|
||||
}
|
||||
} else {
|
||||
if (designationInput) designationInput.classList.remove("is-invalid");
|
||||
}
|
||||
|
||||
if (!dojInput || !dojInput.value.trim()) {
|
||||
if (dojInput) {
|
||||
dojInput.classList.add("is-invalid");
|
||||
dojInput.required = true;
|
||||
hasErrors = true;
|
||||
}
|
||||
} else {
|
||||
if (dojInput) dojInput.classList.remove("is-invalid");
|
||||
}
|
||||
} else {
|
||||
// No values in this row, remove validation
|
||||
if (companyNameInput) {
|
||||
companyNameInput.classList.remove("is-invalid");
|
||||
companyNameInput.required = false;
|
||||
}
|
||||
if (designationInput) {
|
||||
designationInput.classList.remove("is-invalid");
|
||||
designationInput.required = false;
|
||||
}
|
||||
if (dojInput) {
|
||||
dojInput.classList.remove("is-invalid");
|
||||
dojInput.required = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Also check the "experience" radio buttons
|
||||
const experienceRadios = document.querySelectorAll('input[name="experience"]');
|
||||
const isExperienced = Array.from(experienceRadios).some(radio =>
|
||||
radio.value === 'experienced' && radio.checked
|
||||
);
|
||||
|
||||
if (isExperienced) {
|
||||
// If user selected "Experienced", check if at least one employer is filled
|
||||
const anyEmployerFilled = Array.from(rows).some(row => {
|
||||
return Array.from(row.querySelectorAll('input')).some(input =>
|
||||
input.value && input.value.trim() !== ''
|
||||
);
|
||||
});
|
||||
|
||||
if (!anyEmployerFilled) {
|
||||
alert("Please fill at least one employer detail since you selected 'Experienced'");
|
||||
hasErrors = true;
|
||||
}
|
||||
}
|
||||
|
||||
return !hasErrors;
|
||||
}
|
||||
|
||||
// Add real-time validation as user types
|
||||
const employerInputs = document.querySelectorAll('#previous_employer_table_body input');
|
||||
employerInputs.forEach(input => {
|
||||
input.addEventListener('input', function() {
|
||||
// When user types in any employer field, validate that row
|
||||
const row = this.closest('tr');
|
||||
if (row) {
|
||||
validateRow(row);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Add change event to experience radio buttons
|
||||
const experienceRadios = document.querySelectorAll('input[name="experience"]');
|
||||
experienceRadios.forEach(radio => {
|
||||
radio.addEventListener('change', function() {
|
||||
if (this.value === 'experienced' && this.checked) {
|
||||
// Make first employer row required
|
||||
const firstRow = document.querySelector('#previous_employer_table_body tr');
|
||||
if (firstRow) {
|
||||
const companyNameInput = firstRow.querySelector('input[name="company_name"]');
|
||||
const designationInput = firstRow.querySelector('input[name="designation"]');
|
||||
const dojInput = firstRow.querySelector('input[name="doj"]');
|
||||
|
||||
if (companyNameInput) companyNameInput.required = true;
|
||||
if (designationInput) designationInput.required = true;
|
||||
if (dojInput) dojInput.required = true;
|
||||
}
|
||||
} else if (this.value === 'fresher' && this.checked) {
|
||||
// Remove required from all employer fields
|
||||
const allInputs = document.querySelectorAll('#previous_employer_table_body input');
|
||||
allInputs.forEach(input => {
|
||||
input.required = false;
|
||||
input.classList.remove("is-invalid");
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Helper function to validate a single row
|
||||
function validateRow(row) {
|
||||
const companyNameInput = row.querySelector('input[name="company_name"]');
|
||||
const designationInput = row.querySelector('input[name="designation"]');
|
||||
const dojInput = row.querySelector('input[name="doj"]');
|
||||
|
||||
// Check if ANY field in this row has a value
|
||||
const hasValues = Array.from(row.querySelectorAll('input')).some(input =>
|
||||
input.value && input.value.trim() !== ''
|
||||
);
|
||||
|
||||
if (hasValues) {
|
||||
// Set required attributes
|
||||
if (companyNameInput) companyNameInput.required = true;
|
||||
if (designationInput) designationInput.required = true;
|
||||
if (dojInput) dojInput.required = true;
|
||||
|
||||
// Validate
|
||||
if (companyNameInput && !companyNameInput.value.trim()) {
|
||||
companyNameInput.classList.add("is-invalid");
|
||||
} else if (companyNameInput) {
|
||||
companyNameInput.classList.remove("is-invalid");
|
||||
}
|
||||
|
||||
if (designationInput && !designationInput.value.trim()) {
|
||||
designationInput.classList.add("is-invalid");
|
||||
} else if (designationInput) {
|
||||
designationInput.classList.remove("is-invalid");
|
||||
}
|
||||
|
||||
if (dojInput && !dojInput.value.trim()) {
|
||||
dojInput.classList.add("is-invalid");
|
||||
} else if (dojInput) {
|
||||
dojInput.classList.remove("is-invalid");
|
||||
}
|
||||
} else {
|
||||
// No values, remove requirements
|
||||
if (companyNameInput) {
|
||||
companyNameInput.required = false;
|
||||
companyNameInput.classList.remove("is-invalid");
|
||||
}
|
||||
if (designationInput) {
|
||||
designationInput.required = false;
|
||||
designationInput.classList.remove("is-invalid");
|
||||
}
|
||||
if (dojInput) {
|
||||
dojInput.required = false;
|
||||
dojInput.classList.remove("is-invalid");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Previous button logic
|
||||
prevButtons.forEach(button => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue