My app takes some parameters from a form, uses it as input for another script, and then returns the output. How can I create a refresh button to redirect the user on the initial page without output? I tried this code in the template:
<form action= {{url_for('index')}} method='POST'>
<input type='submit' value="REFRESH">
</form>
But this gave me an error that the "View function did not return a response". I also tried:
<form action= {{redirect(url_for('index'))}} method='POST'>
<input type='submit' value="REFRESH">
</form>
But this gave me the error "'redirect' is undefined" even though my view imported both redirect
and url_for
.
You don't need to submit a form to clear the values in it. You can use a reset button.
<input type="reset" value="REFRESH">
This will restore the values -- or lack thereof -- from when the page loaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With