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

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

radhannAsked:
Who is Participating?
 
GurunathansConnect With a Mentor Commented:
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
 
radhannAuthor Commented:
HI,
Thank u so much....
0
 
radhannAuthor Commented:
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
 
GurunathansCommented:
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
 
radhannAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.