Reputation: 125
I have django form, then for each field I set initial value. How can I make POST
request in my view.py
(like after pressing submit button) without rendering the form. I just need to send these initial values as POST request to another url.
Upvotes: 0
Views: 640
Reputation: 2984
You can create the form in HTML and set display:none
is style attributee of each field. It will hide the form from front-end and when you click on submit button it will send all data in POST request.
<form method='post'>
<input name='field_name' style='display:none' value='abc'>
<input type='submit' value='submit'>
</form>
Above code will show only submit button on front-end and by clicking on it, it will send value of input field in POST request.
Upvotes: 1