CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Press a button, open page in new window (out of iframe)

Print topic Send  topic

Author Message
Chris__T


Posts: 339
Posted: 11/25/2009, 1:27 PM

Using Iframes. When I get to a certain page (Page A), I have a button on it that when pressed, sends database data (from Page A) to a new form-letter styled page (Page B). however, this new page B stays in the frame that used to have Page A.

I want to click the button on Page A, and have Page B come up in a new window, out of the Frame. But B still has to have the data from Page A

The button used on Page A is a form button (not HTML), so I filled in the "Return Page" parameter as the formletter.ccp
View profile  Send private message
andrewi

Posts: 154
Posted: 11/25/2009, 3:11 PM

Interesting problem - I have needed to do something similar. If I understand, you want to submit the contents of a form to an asp page and show the results in a new window (leaving the original Page A unchanged).

I think it will need Javascript in addition to what Codecharge can do (unless you already have a second window open and know its name).

Put this button in the form that you're submitting

<input type="submit" value="Submit"  
onclick="popSubmit(this.form);"> 

And add this javascript:
  
<script type="text/javascript">   
function popSubmit(form)   
{   
var popStyle = "width=300,height=300,location=yes,resizable=yes";   
var popName = "formPopUp";   
form.action = "formletter.asp";   
form.target = popName;  
window.open("",popName,popStyle);   
}   
</script>   

adjust height and width as required, and change "formletter.asp" to the location of your formletter asp (not ccs) page.

I got this code from http://www.webmasterworld.com/forum91/4951.htm.

The code sets the target of your form (that would be on Page A) to be "formPopUp", and then it opens a new window with this name. Then the form is submitted (the normal action of the button) and the results go to the target, which is the newly-opened window.
View profile  Send private message
Chris__T


Posts: 339
Posted: 11/30/2009, 8:27 AM

Andrewi,

Thanks, it popped it up, but didn't populate the new window with the data in the form fields. Just left blank spaces.

Looks like i'm just loading test_letter.asp (my filename) and not test_letter.asp?permit_id=xxxxxx
View profile  Send private message
Chris__T


Posts: 339
Posted: 11/30/2009, 8:34 AM

Nevermind...fixed it.

Just added/modified the javascript function you gave me:

function popSubmit(form)     
{     
var popStyle = "width=300,height=300,location=yes,resizable=yes";     
var popName = "formPopUp";  
var TempID=document.permit.Text1.value;     
form.action = "../letters/test_letter.asp?Permit_ID="+TempID;     
form.target = popName;    
window.open("",popName,popStyle);     
}   

TempID gets the permit number from the form. Then in the form.action line, TempID is added to the end of the URL line, bringing up that record's data

Thanks for your help , andrewi !
View profile  Send private message
andrewi

Posts: 154
Posted: 12/01/2009, 2:17 PM

Glad it helped.

Thinking why it didn't work at first, I think the solution in this case might be to check that the form method is GET (rather than post), and change the name of the textbox Text1 to Permit_ID. Then you shouldn't have to add the Permit_ID manually to the form action.

However, I wouldn't change it now if it works. But if you had to pass the value of more than one field, the original method would save a bit of effort.
View profile  Send private message
Chris__T


Posts: 339
Posted: 12/04/2009, 11:12 AM

I will keep the GET method in mind for the next time I have to do something similar. Sounds like it would save some time. Thanks.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.