Reputation: 1089
I use target="_blank"
for my form submission to open the resulting page in new window but the previous or form page is still open and holding the values filled for form submission . If i click submit again it submits again with same values, so how would i refresh form page after submission.
<form target="_blank" id="monthly_form" method="post" action="<?php echo base_url().'billing/monthly_slip'; ?>">
..form fields
...
</form>
Upvotes: 2
Views: 20331
Reputation: 1780
<form method="post" onsubmit="window.location.reload()">
<input type="submit" value='go' />
</form>
Upvotes: 1
Reputation: 7475
Do not use target="_blank"
for form submission, Instead post the form normally and redirect from controller. But if you really need to use target="_blank"
then after form submit just reload the page or reset the form.
Upvotes: 0
Reputation: 100175
try something like:
$(document).ready(function() {
$('#your_form_id').on('submit', function(evt) {
evt.preventDefault();
setTimeout(function() {
window.location.reload();
},0);
this.submit();
});
});
Upvotes: 3