Python Forum
request.form[ Dynamic Value]. How to?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
request.form[ Dynamic Value]. How to?
#1
Just a quick one.

If i had a dynamically created table which i plan to use to input more information to a FLASK SQLALCHEMY database.

And the selects had ids and names such it was set up to dynamically create like so:

<select class='pdf03_select' type='text' name='related_to_{{name}}' id='related_to_{{name}}' placeholder='Select a Doc Type...'>
How would i request the input from a python script using the format:

related_to = request.form['related_to_{{name}}']
Thanks in advance.

Jack

So i was just being an idiot, never tried the simplest solution. As name was a python variable.

related_to = request.form['related_to_'+name]

Is the correct format
thread can be deleted as i assume no one will ever come across this error :P
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Flask Basics request.form ifigazsi 0 1,804 Feb-09-2021, 09:05 AM
Last Post: ifigazsi
  Flask request.form ifigazsi 2 3,693 Feb-02-2021, 11:56 AM
Last Post: buran
  Using Python request without selenium on html form with javascript onclick submit but eraosa 0 3,170 Jan-09-2021, 06:08 PM
Last Post: eraosa
  POST request with form data issue web scraping hoff1022 1 2,682 Aug-14-2020, 10:25 AM
Last Post: kashcode
  Scraping a dynamic data-table in python through AJAX request filozofo 1 3,881 Aug-14-2020, 10:13 AM
Last Post: kashcode
  Jinja sort values from request.form SpongeB0B 2 2,220 Jul-26-2020, 07:41 AM
Last Post: SpongeB0B

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020