Page 1 of 1
Contain subsequent page loading
Posted: Sat Dec 02, 2006 11:26 pm
by rastarr
Hi,
I'm putting together a little DHTML popup which contains a form passing contact details to a SwiftMailer script - note that the popup is created using a phpAdsNew banner popup.
I've managed to get the things working in a rudementary fashion however the HTTP Post to the Swift script always opens a full browser window (which is blank as the operation was successful). I'm looking for a way for this not to happen at all or to have the page at least load within the pop-up window.
Any help would be fantastic
Martin
Posted: Sun Dec 03, 2006 1:35 am
by RobertGonzalez
Can you post the form code? I suspect there is something in the form that is telling it to do this.
Posted: Sun Dec 03, 2006 2:51 am
by rastarr
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi Everah,
Thanks for replying - would certainly appreciate you checking it out - fairly basic Dreamweaver form below:
[syntax="html"]
<script type="text/javascript">
<!--
function MM_popupMsg(msg) { //v1.0
alert(msg);
}
//-->
</script>
<body bgcolor="#FFFFFF">
<h1 align="center"><font color="#840283" size="4" face="Verdana, Arial, Helvetica, sans-serif">Zeolites Health Special Report</font> </h1>
<h5 align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Want a sharp concise report of Natural Cellular Defense?<br />
Please complete the autoresponder form below and this report will be immediately emailed to you </font></h5>
<form action="http://www.zeoliteshealth.com/Swift/send_attachment.php" method="post" name="contact_us_form" target="_parent" id="contact_us_form">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">name: </font></div></td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<label for="textfield"></label>
<input name="name" type="text" id="name" value="Please Enter Name here" size="40" maxlength="50" />
</font></td>
</tr>
<tr>
<td><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">email address: </font></div></td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<input name="email_address" type="text" id="email_address" size="40" maxlength="50" />
</font></td>
</tr>
<tr>
<td><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">phone number: </font></div></td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<input name="phone_number" type="text" id="phone_number" size="40" maxlength="40" />
</font></td>
</tr>
<tr>
<td><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">comment: </font></div></td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<textarea name="comment_field" cols="37" rows="5" wrap="virtual" id="comment_field">Please send me the special report on Natural Cellular Defense.
</textarea>
</font></td>
</tr>
<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<input name="recipient" type="hidden" id="recipient" value="martin@zeoliteshealth.com" />
<input name="subject" type="hidden" id="subject" value="Special Report" />
</font></td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<input name="Click to Send" type="submit" id="Click to Send" onclick="MM_popupMsg('Thank-you.\rThe Report will be in your email shortly.')" value="Click to Send" />
<input name="Reset Form" type="reset" id="Reset Form" value="Reset Form" />
</font></td>
</tr>
</table>
</form>
<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">All information submitted is kept strictly confidential.</font></div>
Cheers and thanks for the help - the new window (or any window) popping up after the submit button is really bugging me.
Martin
feyd | Please use[/syntax]Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Posted: Sun Dec 03, 2006 8:34 am
by rastarr
Sorry about the mess up with the syntax, people. Won't happen again.
I appreciate the service and help being offered here - great forum.
Look forward to someone being able to help me with the POST issue - driving me crazy. Hopefully it doesn't come to this AJAX thing which I know nothing about

Posted: Sun Dec 03, 2006 2:13 pm
by RobertGonzalez
It is the target attribute of the form tag. It is looking to open up the posted page in the parent frame/window. Either specify a window name or remove the forced page opening of the form.
Posted: Sun Dec 03, 2006 4:42 pm
by rastarr
Everah,
Thanks for the reply.
I've used all options for the target attribute as well as leaving it out but no luck. What do you actually mean by specifying a window name> The form needs to post to a php script for the mailing - is this the forced page opening you're referring to?
Posted: Mon Dec 04, 2006 1:25 am
by RobertGonzalez
Lets see if I have this problem understood. You are popping open a window that contains a form. When the form submits, it opens another (third) window that is blank because the page that is receiving the form post is a mailer script that sends a mail and does nothing else. Am I correct?
If I understand this correctly, what you want to do is, in the first opened window (the one with the form - window 2) is not specify a target attribute in the form. So this:
Code: Select all
<form action="http://www.zeoliteshealth.com/Swift/send_attachment.php" method="post" name="contact_us_form" target="_parent" id="contact_us_form">
Would become this
Code: Select all
<form action="http://www.zeoliteshealth.com/Swift/send_attachment.php" method="post" name="contact_us_form" id="contact_us_form">
Then, on the
http://www.zeoliteshealth.com/Swift/send_attachment.php page, after the mailing has been done, I would use some javascript to close window 2 and second focus back to the parent window. Maybe something along the lines of...
Code: Select all
function send_back_to_caller()
{
opener.document.location.href = "some_page_to_go_to.php";
window.close();
}
which I would call with the onLoad event of the body tag
Code: Select all
<body onLoad="send_back_to_caller();">
I am certainly no pro at Javascripting, but this is the logic I would use anyway. Window 1 opens window 2. Window 2 handles an input, processes the input, closes itself and returns focus to window 1.
Posted: Mon Dec 04, 2006 2:44 am
by rastarr
I must be doing something wrong here or simply not understanding your solution.
I think you have my requirements understood. I have a site running phpAdsNew - phpAdsNew is creating a popup that contains a form. This form POSTS to a php mailer script that sends a PDF. I'm wanting to use phpAdsNew as it has Geographic facilities to allow me to tailor the documentation sent.
I've removed the target="_parent" tag and the popup still allows this php mailer window to be created - is there no way that using a DHTML popup that the mailer window can remain in the pop-up, at the very least?
I'm a little confused with the JS code. Is this to close the mailer window or the form window? Is there any way to prevent the mailer window from opening in the first place?
Window 1 - main site
window 2 - form page that posts to mailer script (nice if this could close after submitting)
window 3 - mailer script that opens a full browser window. (prefer this not to open in the first place)
I'm beginning to think this is a bug / inablility with phpAdsNew to carry out basic execution.
Posted: Mon Dec 04, 2006 10:16 am
by RobertGonzalez
I would suggest, first, that you clear your browser cache. Then load the pages again. The only reason your form would be opening a new window is if it is told to do so in the target attribute of the <form> tag. The only other attribute value I can think of for target (to force it to load in the current page) is "_top".
What I had suggested in my last post is that you post back the form so that it sends the form data to itself, processes the data sending (mailing) then closes itself.