Python Forum

Full Version: request.form[ Dynamic Value]. How to?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.


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