I am creating a form right now with which an event (e.g. concernt) can be created. Since I need a lot of information from the user, I looked for a multi-step form and found this one here. I now have the form but I don't know how to call a new page once the form is submitted.
<form action="....." method="post" id="createEvent">
From my understanding the new page that is called has to be in the action parameter of the form, but I tried giving it the path of a different cshtml page with no luck.
function nextPrev(n) {
// This function will figure out which tab to display
var x = document.getElementsByClassName("tab");
// Exit the function if any field in the current tab is invalid:
if (n == 1 && !validateForm()) return false;
// Hide the current tab:
x[currentTab].style.display = "none";
// Increase or decrease the current tab by 1:
currentTab = currentTab + n;
// if you have reached the end of the form... :
if (currentTab >= x.length) {
//...the form gets submitted:
document.getElementById("createEvent").submit();
return false;
}
// Otherwise, display the correct tab:
showTab(currentTab);
}
This is the function from w3schools, and the comments say it is submitted with the document.getElementById("createEvent").submit(); but nothing happens. Shouldn't this then call the action from the form-tag?
Since there is little explanation on the w3schools page, I thought I'd ask here, maybe someone else understands javascript more than I do.