I have the following code from create-app.js. How to modify the code so that the form will be submitted to server side upon clicking the submit button.
formSubmitButton.addEventListener("click", function (e) {
// Validate form before change stepper step
var validator = validations[2]; // get validator for last form
validator.validate().then(function (status) {
formSubmitButton.disabled = false;
if (status == "Valid") {
// Prevent default button action
e.preventDefault();
// Disable button to avoid multiple click
formSubmitButton.disabled = true;
// Show loading indication
formSubmitButton.setAttribute("data-kt-indicator", "on");
// Simulate form submission
setTimeout(function() {
// Hide loading indication
formSubmitButton.removeAttribute("data-kt-indicator");
// Enable button
formSubmitButton.disabled = false;
$( "#create_new_bo" ).submit();
}, 2000);
} else {
Swal.fire({
text: "Sorry, looks like there are some errors detected, please try again.",
icon: "error",
buttonsStyling: false,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn btn-light"
}
}).then(function () {
KTUtil.scrollTop();
});
}
});
});
Your blog post was exactly what I needed today. Thank you for providing such valuable information in such an engaging way.
Delhi Escorts
With Sprunki Game - Play Online Incredibox Mod, digital music creation becomes an adventure. Featuring entertaining characters, dynamic beats, and eye-catching visuals, it’s designed to let users of any skill level explore rhythm and melody in an interactive way. Sprunki Mode
I totally agree with you Sprunki. ............................................................................................................................................................................................................................................................................................................
Hi,
You should use the form object and call it's submit method form.submit()
as shown below:
Replace the below demo timeout code to similate the form processing:
// Simulate form submission
setTimeout(function() {
// Hide loading indication
formSubmitButton.removeAttribute("data-kt-indicator");
// Enable button
formSubmitButton.disabled = false;
stepperObj.goNext();
}, 2000);
// Hide loading indication
formSubmitButton.removeAttribute("data-kt-indicator");
// Enable button
formSubmitButton.disabled = false;
stepperObj.goNext();
form.submit();
Thank you Sean!. You saved my life. All good now.
Always glad to help you
Your content is a breath of fresh air—so clear and well-written. I really appreciate how you break down the details. Thanks a lot for making this so readable! Madhur Day
I tried $( "#create_new_bo" ).submit(); but it does not work