I am writing a Flask app. I created a dropdown menu (list is produced by an external function called get_ligand_list here):
@app.route('/displayLigands', methods=['GET','POST'])
def dropdown():
file = os.path.join(UPLOAD_FOLDER)
molfile = UPLOAD_FOLDER + session.get('str_file', None)
ligands = get_ligand_list(molfile)
return render_template('run_ligand.html', ligands=ligands)
And corresponding HTML:
<form name="Item_1" action="{{ url_for('displayLigands') }}" method='POST'>
<label for="exampleFormControlFile2">Choose ligand</label>
<select name=ligands>
{% for ligand in ligands %}
<option value="{{ligand}}">{{ligand}}</option>
{% endfor %}
</select>
<a class="btn btn-outline-primary btn-lg button-custom button-submit" type="submit" value="submit" href="{{ url_for('display_3dmol') }}">Next</a>
</form>
Everything is okay, the list is displayed.
How can I now retrieve the value from the list selected by the user?
Thank you!