Solved

How to post form data to new window in javascript? Like window.open(...)

Posted on 2008-06-12
5
1,745 Views
Last Modified: 2010-04-21
I have large form data to be submitted to a new window through javascript. I am only able to pass url variables.

<a href="javascript:OpenExport('export.asp?usr=test&SA1');"><b>Excel Export</b></a>
 

 function OpenExport(pURL)

    {

        window.open(pURL,"Export","status=0,scrollbars=0,width=300,height=150");

    }
 

The above code only opens a new window with url variables. But I need to post the form.

Open in new window

0
Comment
Question by:radhann
  • 3
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
Gurunathans earned 250 total points
ID: 21773295
Hello Member,
In the New window you can have the following Javascript to extract values from the Parent Window:
var Val1 = self.opener.document.getElementById("name_of_some_input_control_from_parent_window").value;

The above should be included within the Head section of the New window.


0
 

Author Closing Comment

by:radhann
ID: 31466602
HI,
Thank u so much....
0
 

Author Comment

by:radhann
ID: 21780473
The above solution gives the form data for client side scripting. Can we get the value in server side code(ASP). I use the posted value from parent window to fetch records from database.
0
 
LVL 1

Expert Comment

by:Gurunathans
ID: 21780551
Hello radhann,
I am not very knowledgeable about Classic ASP, but I will still give it a shot.
Let me try to understand your requirement clearly:
You want to be able to capture the form values on a web page (which is a request from a user) and return the results of the request in a Excel sheet which can be saved to the User's local system.
Is this the requirement ?
0
 

Author Comment

by:radhann
ID: 21782849
Hi Gurunathans,
Yes, my requirement is to fetch records from database based on search criteria from form and save the result as excel file in server and then give the file as link to download in the new window.
What I do is, give a search page in asp with few input controls like date, etc. I provide a link on the same page "Export To Excel". When user clicks on this link, I want to open new window and perform database operations on the new page using posted value from parent window. Since there are more than 10 form fields that i need to access, I dont want to pass values as url variables.

Thanks in advance
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video teaches users how to migrate an existing Wordpress website to a new domain.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now