0

I decided to go with trading from index without manually typing the symbol. Also, I decided to simply go to the buy/sell page with the symbol pre-selected by a GET method (without quantities being entered in Index, but rather in Buy or Sell)

I'm struggling now with pre-uploading the parameter passed to this Buy page into the Symbol form window. I've passed the symbol parameter(e.g. NFLX in the query) above from Index page using name.

In particular by using this HTML:

<form action="/buy" method="get">
   <td><button  name={{ row["symbol"] }} class="btn btn-primary" type="submit">Buy</button></td>
 </form>

How can I make it so that this name parameter is typed into Symbol window automatically? I read about request.args but it doesn't work.

Could please someone help?

Thank!

Buy page

0

There are ways to iterate request.args to get the sent key, for example:

for key in request.args:
    print(key)

Instead of having to "figure out" the key in request args (ie the "name" passed from the client), it would be more straightforward if all the buttons had the same name attribute (eg symbol) with value attribute set to the desired value (ie {{ row["symbol"] }}). Then buy would know request.args['symbol'] is the requested stock.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .