0% found this document useful (0 votes)
21 views3 pages

Simple Advance Multi-step Form with Progress Bar

The document contains JavaScript code for a web application that manages a multi-step form with navigation buttons for moving between states. It includes functionality for enabling/disabling buttons based on user input, handling employment status visibility, and managing form submission with progress tracking. Additionally, it provides error handling and the ability to resubmit the form after saving.

Uploaded by

iSound
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

Simple Advance Multi-step Form with Progress Bar

The document contains JavaScript code for a web application that manages a multi-step form with navigation buttons for moving between states. It includes functionality for enabling/disabling buttons based on user input, handling employment status visibility, and managing form submission with progress tracking. Additionally, it provides error handling and the ability to resubmit the form after saving.

Uploaded by

iSound
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Copy Code Below 👇

$w.onReady(function () {​

//NEXT BUTTONS​
$w("#nextButton1").onClick(function () {​
$w("#jobMultiStateBox").changeState("addressDetails");​
$w("#progressBar1").value = 35;​
$w("#button2").enable();​

$w("#anchor1").scrollTo();​
});​

$w("#nextButton2").onClick(function () {​
$w("#jobMultiStateBox").changeState("otherDetails");​
$w("#progressBar1").value = 65;​
$w("#button3").enable();​

$w("#anchor1").scrollTo();​
});​

//PREVIOUS BUTTONS​
$w("#previousButton1").onClick(function () {​
$w("#jobMultiStateBox").changeState("personalDetails");​
$w("#progressBar1").value = 0;​

$w("#anchor1").scrollTo();​
});​

$w("#previousButton2").onClick(function () {​
$w("#jobMultiStateBox").changeState("addressDetails");​
$w("#progressBar1").value = 35;​

$w("#anchor1").scrollTo();​
});​

//PROGRESS BUTTONS​
$w("#button1").onClick(function () {​
$w("#jobMultiStateBox").changeState("personalDetails");​
$w("#progressBar1").value = 0;​

$w("#anchor1").scrollTo();​
});​

$w("#button2").onClick(function () {​
$w("#jobMultiStateBox").changeState("addressDetails");​
$w("#progressBar1").value = 35;​

$w("#anchor1").scrollTo();​
});​

$w("#button3").onClick(function () {​
$w("#jobMultiStateBox").changeState("otherDetails");​
$w("#progressBar1").value = 65;​

$w("#anchor1").scrollTo();​
});​

//EMPLOYMENT STATUS​
$w("#employmentStatus").onChange(function () {​
let employStat = $w("#employmentStatus").value;​

if (employStat === "Employed") {​
$w("#currentEmployer").expand();​

$w("#currentEmployer").required = true;​
} else {​
$w("#currentEmployer").collapse();​
$w("#currentEmployer").required = false;​
}​
});​

//VALIDATION ⚠​
$w("#firstName, #lastName, #email").onChange(function () {​
if ($w("#firstName").value.length > 0 &&
$w("#lastName").value.length > 0 && $w("#email").value.length > 0) {​
$w("#nextButton1").enable();​
} else { $w("#nextButton1").disable(); }​
});​

//SUBMIT BUTTON​
$w("#submitButton").onClick(function () {​
$w("#submitButton").label = "Please wait..."​
$w("#submitButton").disable();​
});​

//AFTER SAVE​
$w("#dataset1").onAfterSave(function () {​
$w("#submitButton").label = "Submit";​
$w("#submitButton").enable();​
$w("#jobMultiStateBox").changeState("submitSuccess");​
$w("#progressBar1").value = 100;​

$w("#anchor1").scrollTo();​
});​

//ON ERROR​
$w("#dataset1").onError(function () {​
$w("#submitButton").label = "Submit";​
$w("#submitButton").enable();​
});​

//SUBMIT AGAIN​
$w("#submitAgainButton").onClick(function () {​
$w("#jobMultiStateBox").changeState("personalDetails")​
$w("#progressBar1").value = 0;​

$w("#anchor1").scrollTo();​
});​

});​

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy