/    Sign up×
Community /Pin to ProfileBookmark

close pop up page after email form submits

I have a form on a html page which one fills in and submits using email.

The form has been opened in a pop up page,

Once the form has been submitted, (emailed) I need to add some javasript to say either “thank you,” in the same window and then close it. Or do something else, that the user knows his form has been submitted. The pop up window that says “thank you” can have a close link on it. I do not need to refresh the parent page or refresh anything since the form is an email one.

Any suggestions what to add where? here is the relevant part of the code below. The first part is the code of the pop up window that is used to open it

[CODE]
<a href=”page.htm” onClick=”NewWindow(this.href,’name’,’550′,’430′,’Yes’);return false;”>[/CODE]

next is the relevant parts of the email form

[CODE]<form action=”mailto:[email protected]” method=”POST” enctype=”multipart/form-data” name=”pledgeForm”>[/CODE]

[CODE]
<td align=”left”><input type=”submit” value=”Email This Form”>
</form>[/CODE]

to post a comment
HTML

5 Comments(s)

Copy linkTweet thisAlerts:
@ray326Jul 02.2007 — You really need to use something other than a mailto: action. Then it becomes rather trivial. Plus it can be counted on working, which a mailto: can't.
Copy linkTweet thisAlerts:
@karen987authorJul 02.2007 — You really need to use something other than a mailto: action. Then it becomes rather trivial. Plus it can be counted on working, which a mailto: can't.[/QUOTE]

I'm not html savvy,

Is this hard to do? I was hoping for a one line code solution
Copy linkTweet thisAlerts:
@karen987authorJul 02.2007 — OK i tried this, but the result is still the same, the thank you doesn;t show, and the test email came through exactly as before.

Any tips anyone? Thank you.

[CODE]<form action="mailto:[email protected]" method="POST" enctype="multipart/form-data" name="pledgeForm" onSubmit="document.getElementById('THANKS').style.display='block'; return true;"> [/CODE]

and at the bottom i have this. Just to remind, will this work on a html page or do i have to change it to an asp page?

[CODE] <td align="left"><input type="submit" value="Email This Form">
</form>
<DIV ID="THANKS" style="display: none;">
Thank you for making this pledge.
<P>
<a href="#" onClick="window.close();">Close</a> </DIV>

</table>

</body>
</html> [/CODE]
Copy linkTweet thisAlerts:
@karen987authorJul 02.2007 — I tried this too a slightly different way, see the (modified code below)but didn't receive the email after i tested it. Also the thank you message appears at the bottom of the form, thus people may not even be aware its there.

Is there any way i can make the rest of the data disappear when the "thank you" notice and "close page" thing is there?

In the header i put

[CODE]<script>
function toggle_display() {
var form = document.getElementById('my_form');
var thanks = document.getElementById('THANKS');

form.style.display = 'none';
thanks.style.display = 'block';
}
</script>[/CODE]


at the beginning of the form i put

[CODE]<form action="mailto:[email protected]" method="POST" enctype="multipart/form-data" id="my_form" name="pledgeForm">[/CODE]

and at the bottom of the form i put

[CODE]<input type="button" value="Email This Form" onclick="toggle_display();"/>
</form>
<div id="THANKS" style="display:none;">
Thank you for making this pledge.
<a href="#" onclick="window.close();">Close</a>
</div>
</body>
</html>[/CODE]


Does anyone what i need to change/add/modify to make this work? I need to submit the form, then the thank you message preferably without the rest of the data.

THank you for your patience and time, and to anyone else who may have something to add here.
Copy linkTweet thisAlerts:
@ray326Jul 02.2007 — Look into using a form/mail handler like the one below.

http://www.bignosebird.com/carchive/bnbform.shtml
×

Success!

Help @karen987 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...