Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Submit form and close window

 
Veni Velkoor
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Veni Velkoor
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dave, I'll try looking for the action for the submit.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic