new update
This commit is contained in:
parent
1f4a648db2
commit
0b6c0e353a
13
form.html
13
form.html
|
@ -51,13 +51,12 @@
|
|||
<h1>Professional Details</h1>
|
||||
<label for="education">Education</label>
|
||||
<select id="education" name="education" required>
|
||||
<option value="B.tech">B.tech</option>
|
||||
<option value="M.tech">M.tech</option>
|
||||
<option value="BCA">BCA</option>
|
||||
<option value="MCA">MCA</option>
|
||||
<option value="B.com">B.com</option>
|
||||
<option value="M.com">M.com</option>
|
||||
<option value="Other">Other</option>
|
||||
<option value="B.tech">PG</option>
|
||||
<option value="M.tech">UG</option>
|
||||
<option value="BCA">Diploma</option>
|
||||
<option value="MCA">12th</option>
|
||||
<option value="B.com">10th</option>
|
||||
|
||||
</select>
|
||||
<span class="error" id="error-education"></span>
|
||||
|
||||
|
|
15
script.js
15
script.js
|
@ -13,7 +13,7 @@ function nextStep(step) {
|
|||
document.getElementById(`step${currentStep}`).classList.remove('hidden');
|
||||
document.getElementById(`indicator-step${currentStep}`).classList.add('active');
|
||||
if(step === 3){
|
||||
isValid = populateReview();
|
||||
populateReview();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,14 +55,14 @@ function validatePersonalDetails() {
|
|||
}
|
||||
|
||||
const phone = document.getElementById("phone").value;
|
||||
if (!phone.match(/\d{10}/)) {
|
||||
document.getElementById("error-phone").innerText = "Phone number must be 10 digits";
|
||||
if (!/^\d{10}$/.test(phone)) {
|
||||
document.getElementById("error-phone").innerText = "Phone number must be exactly 10 digits";
|
||||
isValid = false;
|
||||
alert("Phone number invalid. It must be exactly 10 digits.");
|
||||
} else {
|
||||
document.getElementById("error-phone").innerText = "";
|
||||
}
|
||||
|
||||
|
||||
const gender = document.querySelector('input[name="gender"]:checked');
|
||||
if (!gender) {
|
||||
document.getElementById("error-gender").innerText = "Please select your gender";
|
||||
|
@ -191,6 +191,7 @@ function populateReview() {
|
|||
function clearform() {
|
||||
const form = document.getElementById('multistepForm');
|
||||
form.reset();
|
||||
localStorage.removeItem('formData');
|
||||
document.getElementById('reviewFullName').innerText = "";
|
||||
document.getElementById('reviewEmail').innerText = "";
|
||||
document.getElementById('reviewPhone').innerText = "";
|
||||
|
@ -200,10 +201,7 @@ function clearform() {
|
|||
document.getElementById('reviewExperience').innerText = "";
|
||||
document.getElementById('reviewSkills').innerText = "";
|
||||
document.getElementById('reviewCurrentRole').innerText = "";
|
||||
|
||||
document.getElementById('review').classList.add('hidden');
|
||||
|
||||
currentStep = 1;
|
||||
|
||||
document.getElementById('step1').classList.remove('hidden');
|
||||
document.getElementById('indicator-step1').classList.add('active');
|
||||
|
||||
|
@ -211,6 +209,7 @@ function clearform() {
|
|||
document.getElementById(`step${i}`).classList.add('hidden');
|
||||
document.getElementById(`indicator-step${i}`).classList.remove('active');
|
||||
}
|
||||
currentStep = 1;
|
||||
}
|
||||
|
||||
window.onload = loadFormData;
|
||||
|
|
Loading…
Reference in a new issue