Reputation: 1163
When I submit my form, a window to another URL pops up. If I close the popup and resubit the form, the window opens in a new tab until I reload the page. How can I make the window open in a popup every time, without reloading the page?
<form action="http://stackoverflow.com/" method="post" enctype="multipart/form-data" name="imgform" onsubmit="process(); return false;">
// FORM PARAMS
<input type="submit" name="submit" value="Submit" />
</form>
Javascript function:
process = function(){
popWindow = window.open('','popup','width=800,height=600,resizable=yes');
document.imgform.setAttribute('target','popup');
document.imgform.setAttribute('onsubmit','');
document.imgform.submit();
};
Upvotes: 0
Views: 795
Reputation: 46647
on this line:
document.imgform.setAttribute('onsubmit','');
you are clearing the javascript call to your process
function which opens the popup. have you tried just removing this line?
Upvotes: 1