I am trying to get input on a form as shown here:
<div class="container">
<form class="form-signin" method="GET" action="{{url_for('getstonks', ticker='ticker')}}">
<h2 class="form-signin-heading">INPUT TICKER ID</h2>
<br>
<!-- {{ form.csrf_token }} -->
{{ wtf.form_field(form.ticker) }}
<button class="btn btn-lg btn-primary" type="submit">GET</button>
</form>
</div>
Below is my InputForm class
class InputForm(FlaskForm):
ticker = StringField(label="Ticker", validators=[validators.DataRequired()])
And here is my API flask_restful endpoint
api.add_resource(GetStonks, "/api/v1/stocks/<string:ticker>")
Ideally I would take the input, given to the form and then the form action would send you to that URL with the input appended to the end. e.g. if you put "COIN" into the form and you would be routed to my endpoint with the following url: /api/v1/stocks/COIN
I have tried multiple arguments in my
action="{{url_for('getstonks', ticker='ticker')}}">
And it seems like the WHOLE form is being passed instead of just input value within the form ?
Here is an example of the behavior right now in my codes current state:
http://127.0.0.1:5000/api/v1/stocks/%3Cinput%20id%3D%22ticker%22%20name%3D%22ticker%22%20required%20type%3D%22text%22%20value%3D%22%22%3E?ticker=AMZN
I greatly appreciate any guidance, this has been stumping me for a couple days.