aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Submit form and close window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Submit form and close window" Watch "Submit form and close window" New topic
Author

Submit form and close window

Veni Velkoor
Ranch Hand

Joined: Oct 17, 2001
Posts: 65
Hi,
I would like to be able to submit my form and then close the window when a user clicks the exit button. I tried the following code--
if (k == 3)
{
document.Form1.c__Aid_I.value=k;
document.Form1.submit();
wondow.close();
}
else {
document.Form1.c__Aid_I.value=k;
document.Form1.submit();
}
When the Exit button is clicked the window closes but the form is not submitted prior to the close. it works fine when I remove the window.close() statement.
So now I wonder if the submit form and window.close functions can co-exist?? Any ideas/suggestions would be great!
Thanks,
Veni.
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Veni
When you submit a form you have to have an 'action' in the form tag for the form to be submitted to. If you are closing the window then the page the action refers to can not be opened. the data may well be submitted but the user would never know because the window closed.
Dave


Dave
Veni Velkoor
Ranch Hand

Joined: Oct 17, 2001
Posts: 65
Thanks Dave, I'll try looking for the action for the submit.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Submit form and close window