/    Sign up×
Community /Pin to ProfileBookmark

submit parent window on window close

I have a form where every entry has a button that when pressed generates a popup window that allows you to edit a field, which is then sumitted to a mysql database and the window is closed. However in the parent window the information that was submitted does not appear, because it has not recieved the data from the server and redisplayed. I was wondering if there was a way to say, onwindowclose submit, or something of the like. I think it would even work to refresh the parent window (rather than submitting the form) but I don’t know, generally if you refresh using post data it tells you, the world is going to end this form uses post data and you cannot refresh. I understand php and mysql pretty well but really have no clue with java. Please ask for clarification if I was unclear.

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JJul 21.2005 — Have you tried

<BODY onunload="document.formName.submit()">
Copy linkTweet thisAlerts:
@hwttdzauthorJul 21.2005 — Where can I find a document, sort of the equivalent of php.net explaining the syntax here. Because right now I feel like I'm not even guided enough to ask intelligent questions.
Copy linkTweet thisAlerts:
@hwttdzauthorJul 21.2005 — I'm not sure I was clear enough. What I want to do is submit the parent window. So something along the lines of document.forms.formname.submit() of course that's not doing anything at all.
Copy linkTweet thisAlerts:
@Mr_JJul 21.2005 — Try this little example

[code=php]<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY onunload="document.forms['testForm']['Submit'].click()">

<form name="testForm" onsubmit="alert(this.t1.value)">
<input type="text" name="t1" value="This is a test form">
<input type="submit" name="Submit" style="display:none">
</form>

</BODY>
</HTML>[/code]
Copy linkTweet thisAlerts:
@hwttdzauthorJul 21.2005 — Is there a way to do this without using onunload and then also using submit() in place of this click()?
Copy linkTweet thisAlerts:
@Mr_JJul 22.2005 — It might be wise to do a google search
Copy linkTweet thisAlerts:
@hwttdzauthorJul 22.2005 — For future reference the solution that I came up with was: opener.document.forms.myform.submit();

Why would someone go through all the trouble of asking in a forum if it came up on google? Why would someone assume that someone else would have done the prior?
Copy linkTweet thisAlerts:
@Mr_JJul 22.2005 — Sorry for wasting your time, I'd got it into my head that you wanted to submit the form when the parent page was closed and not the popup.
×

Success!

Help @hwttdz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...