Reputation: 6378
Small prob i'm using the following line of code
customerName = window.opener.form2.custName.value;
The problem is that I'm no longer opening the page in a new window, I'm opening it in the same window and thus replacing the older page.
Is there anyway for me to get the same information?
Thanks
Upvotes: 0
Views: 928
Reputation: 7906
You need to pass the value / values you want on to the new page in some way. Some pointers:
Of course, you may also wish to consider the nature of the data. If it is sensitive, you should use the session or form alternatives to ensure that info is not viewable from the outside (in a cookie, or in the browser's URL, for instance).
Upvotes: 0
Reputation: 1579
If you aren't opening a new window, window.opener won't be available.
You could try passing the value of custName on the query string e.g. http://example.com/somepage.htm?custName=<yourValueHere>
.
Its relatively easy to get query string values in javascript, try using http://plugins.jquery.com/project/query-object for example.
Otherwise, set a cookie and retrieve its value on the 2nd page.
Upvotes: 1
Reputation: 18364
Pass it as a paratemer in the query string to the new page.
If you would open the new page as, say: <a href="newPage.html">...
, pass the details as <a href="newPage.html?custName="+document.form2.custName.value>
As an alternative you can use cookies to store the data from page 1 before you navigate away and retrieve it in page 2.
Upvotes: 1