Reputation: 357
Have a confirmation window before submitting, but after returning true(confirm submission) also needs to go to confirmation page.
Have this:
<button type="submit" value="Save" id="Save" onclick="clicked();" >Submit Form</button>
function clicked() {
if (confirm('Are you sure you want to submit? You will not be able to go back.')) {
yourformelement.submit();
} else {
return false;
}
}
Trying to include 'go to' location.href='Confirmation.html' somewhere but unsure exactly how. Any input would be appreciated.
Upvotes: 0
Views: 9238
Reputation: 1
Just put the .html file in the public folder and navigate as usual.
For example:
href = "public/web.html"
worked for me in Nextjs.
Upvotes: 0
Reputation: 438
You should be able to use the window.location.href property to manually perform the navigation :
window.location.href = "Confirmation.html";
Or if you are using a form, simply set the action attribute of the element to "Confirmation.html"
<form action='Confirmation.html'>
Upvotes: 2
Reputation: 5978
The form will not be submitted asynchronously as far as I can see. The server will be able to redirect your browser to another page, by replying with a "Location" header to the form submission.
Upvotes: 0
Reputation: 658
window.location = 'new url'
Should do the trick.
Edit: misunderstood the question. Would placing a PHP header redirect at the bottom of your form process script work?
Upvotes: 0