Advanced Multi-step Form
Personal Details
Address Details
Other Details
Completed!
Personal Details
$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();
});
});