I have a button that submits a form to a flask server and runs a JS function. When the button is pressed the JS function runs, then it is overridden by the flask render_template function. I need the form to be hidden after server-side processing is done and the analyse div to be unhidden.
HTML:
JS button function:
// Function hides the form and unhides the 'analyse' div
// Another function reverses hide() function
function hide() {
var index = document.getElementById('index');
var analyse = document.getElementById('analyse');
index.classList.add('hidden');
analyse.classList.remove('hidden');
}
Server-side Python:
@app.route('/', methods=['GET','POST'])
def index():
return render_template('index.html')
@app.route('/analyse', methods=['GET','POST'])
def analyse():
# Validation and functions, etc.
return render_template('index.html')
The JS should hide the form, but the Python makes it re-appear and hides the analyse div again (this is what I mean by "override").