2

I have a select tag in my form

    <select name="source" id="source">
        {% for row in inode.inodes %}
            <option value="{{loop.index}}">{{ row.inode.title }}</option> 

While the values are used to order the options, what interests me is the text in the option.

however, in the python code,

source = request.form['source']

Is preferring the value. How can I retrieve the text inside the tag instead?

SecretAgentMan
  • 2,856
  • 7
  • 21
  • 41
Oz Fraier
  • 45
  • 3

1 Answers1

0

There can be multiple solutions to this.Try to implement one of these can see if it works

  1. You can keep value and text same
  2. Fetch value via jquery/js in frontend and then post it in variable to access them in flask
  3. Set data-attribute for options and send them to flask. See here
Jan Wilamowski
  • 3,308
  • 2
  • 10
  • 23
Amarpreet Singh
  • 2,242
  • 16
  • 27