I have a submitting form, that on submit is doing some complex process and then in django views I have this:
return redirect('match:finding', ...)
Could I add something to views to make this redirection not on the page where submit form was completed, but in new tab? Like, leaving tab with form as it is, and then open a new window to continue the process.
In html template it looks like this:
<div class="form-input">
<input id="app-submit" type="submit" value="{% if credit_card %}Get Started{% else %}Loan{% endif %}"/>
</div>
I can't just add a/span tag with target="_blank" or window.open('url', 'new window') as the url will be generated after actually clicking submit button.
Add a target="_blank"
attribute in your form
[1]. Since you're redirecting, it doesn't matter if url is generated after submit.
Example setup would be somewhat like this:
-- views.py
def ex_form_view(request):
...
return redirect('...', ...)
-- urls.py
url(r'^ex_form', views.ex_form_view, name='example')
-- template.html
<form action="ex_form" target="_blank">
<input id="app-submit" type="submit" value="{% if credit_card %}Get Started{% else %}Loan{% endif %}"/>
</form>
[1] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#Attributes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With