Basic structure html and form navigation #1

Merged
sumitdml123 merged 1 commit from dev into main 2025-01-02 09:54:30 +00:00
Owner

Only half way done.

Only half way done.
rishav_dml added 1 commit 2024-12-26 09:12:49 +00:00
rishav_dml requested review from sumitdml123 2024-12-26 09:13:21 +00:00
rishav_dml requested review from mayank.sethi 2024-12-26 09:13:21 +00:00
sumitdml123 approved these changes 2024-12-26 11:40:45 +00:00
@ -0,0 +44,4 @@
id="phone"
class="rounded p-1"
minlength="10"
maxlength="10"
Collaborator

replace maxlength and minlength with max and min

replace maxlength and minlength with max and min
@ -0,0 +81,4 @@
name="age"
id="age"
class="rounded p-1"
pattern="^(1[89]|[2-9][0-9]|100)*$"
Collaborator

Replaced regex with min="18" and max="100"

Replaced regex with min="18" and max="100"
@ -0,0 +1,56 @@
// const form = document.getElementById("personal-details-form"); // Main form element
Collaborator

remove the commented code

remove the commented code
script.js Outdated
@ -0,0 +27,4 @@
const forms = document.querySelectorAll("[data-form]");
var currentStep = 0;
var currentForm = forms[currentStep];
Collaborator

function decrementStep() {
// Prevent going to a negative step
currentStep = Math.max(currentStep - 1, 0);
handleFormVisibility();
}

function decrementStep() { // Prevent going to a negative step currentStep = Math.max(currentStep - 1, 0); handleFormVisibility(); }
script.js Outdated
@ -0,0 +28,4 @@
var currentStep = 0;
var currentForm = forms[currentStep];
function incrementStep() {
Collaborator

function incrementStep() {
if (!validateForm()) return; // Early exit if form is invalid

// Proceed to next step
currentStep = Math.min(currentStep + 1, forms.length - 1); // Prevent going beyond the last form
handleFormVisibility();
}

I added Math.min and Math.max to ensure that currentStep doesn't go out of bounds(below 0)

function incrementStep() { if (!validateForm()) return; // Early exit if form is invalid // Proceed to next step currentStep = Math.min(currentStep + 1, forms.length - 1); // Prevent going beyond the last form handleFormVisibility(); } I added Math.min and Math.max to ensure that currentStep doesn't go out of bounds(below 0)
Author
Owner

if (!validateForm()) return;
This is causing some unknown behavior, therefore not including this.

if (!validateForm()) return; This is causing some unknown behavior, therefore not including this.
rishav_dml added 1 commit 2024-12-26 13:02:39 +00:00
rishav_dml added 1 commit 2024-12-27 06:02:16 +00:00
rishav_dml requested review from sumitdml123 2024-12-27 06:04:01 +00:00
sumitdml123 merged commit 0c8fc30abc into main 2025-01-02 09:54:30 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: rishav_dml/Assignment02-Multi-Step-Form-Wizard#1
No description provided.