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
|
|
|
andrewi
Posts: 162
|
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.
|
|
|
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
|
|
|
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 !
|
|
|
andrewi
Posts: 162
|
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.
|
|
|
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.
|
|
|
|
|
|
|
|