python - How to get the Jinja2 generated input value data? -


in html file, have:

  <table>       {% user in user_data_html %}       <tr>          <td>             <input id="firstname" name="firstname" type="text" value='{{ user.firstname }}' />            </td>          <td>              <input name="submit" type="submit" value='update' />          </td>      </tr>      {% else %}      <tr><td>no user found</td></tr>      {% endfor %}  </table> 

i want modify user name in webpage clicking update button in each row. first "firstname" using following python code in backend:

firstname = request.form['firstname'] 

how can solve problem?

forms confused when use same name each input name. either create separate form around each table cell first name or can use jinja2 loop index create unique input names...

<input id="firstname{{ loop.index }}" name="firstname{{ loop.index }}" type="text" value='{{ user.firstname }}' /> 

hope helps!


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -