Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop-up

Status
Not open for further replies.

conceptmgt

IS-IT--Management
Sep 12, 2001
45
GB
Hi

I am using the javascript below to get my pop-up. The problem is when I submit my code generatorP.asp does not read the form values. It was working fine until I added the pop-up. Any Ideas?

Thanks

Gary

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval(&quot;page&quot; + id + &quot; = window.open(URL, '&quot; + id + &quot;', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=300,left = 376,top = 282');&quot;);
}
// End -->
</script>

<form method=&quot;post&quot; onSubmit=&quot;javascript:popUp('generatorP.asp')&quot;>
 
You need to submit the form to the pop window....

<script>
function subForm(URL){
formWin = window.open(&quot;&quot;,&quot;myWinName&quot;)
document.myForm.method = &quot;post&quot;
document.myForm.action = URL
document.myForm.target = formWin
document.myForm.submit()
}
</script>

<form name=&quot;myForm&quot;>
.....
<input type=button onClick=&quot;subForm()&quot; value=&quot;Submit&quot;>
</form> Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
It's sad that some Americans proudly turn their backs on the very Flag the gives them the opportunity to do just that... - Mike
 
That's normal and and'll try to explain you why :
If you look at the behavior of your browser, here's what happen when user clicks submit button :
- First : onsubmit event is raised and your popup window is openned with 'generatorP.asp' page in it.
- Then, your browser will try to submit the form that have been submited to the page written in 'Action' attribute of the form tag .... Now, you begin to understand ???

In fact, a submitting action in a client to server page sending while a popup opening is a full client feature. So when the ASP code in 'generatorP.asp' tries to read any 'Request.form(&quot;xxx&quot;)' value, It hangs because your asp page doesn't have any calling form : your form calls a script function that calls the asp page.

So, you've got to cut your code in two :
1st : store your values in DB (or anything that you want to do with the form value).
2nd : redirect (in asp) the response to another page that'll open the popup. Water is not bad as long as it stays out human body ;-)
 
OOPPSS! I forgot to include the URL in the submit button...

<input type=button onClick=&quot;subForm('generatorP.asp')&quot; value=&quot;Submit&quot;> Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
It's sad that some Americans proudly turn their backs on the very Flag the gives them the opportunity to do just that... - Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top