I have a page with ofers the user to add data to a database, if the user
selects to add data a new window/page is created and a form is generated
on the fly. This page has a submit button, so the user can submit the form.

I will like this page to close when the user submits the data(using the submit
button), however, I do not what the warning window to popup asking the user
if she/he wants to close the page. This way the user will left with the original
page she/he was looking at.