Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting a value on parent window when opening a pop-up

Status
Not open for further replies.

MollyMoon

Programmer
Mar 3, 2003
18
0
0
US
Hello,

I searched the FAQ's and found a similar problem (thread216-7131253) but couldn't get it to work for me. I am trying to set the value of one hidden field ("optionsChanged") as part of a function that also stores the values of all the fields on the form in a cookie prior to opening a pop-up window. When I used the code from the aforementioned thread (basically, setting the value of the hidden field in a separate function) it threw the error that the object did not exist.

Here's the code that sets the value of the hidden field, stores the values from the form in an existing cookie, and opens the pop-up window. The creation of the cookie and the storing of data in the cookie works fine for ALL other fields, except the one being set in the Javascript.

The alert (currently commented out) displays the value as if it is set correctly, but that value is not stored in the cookie, although everything else is. ???

Thanks for your help.


/******************

open_window(p_href)

Open a popup window with the location of p_href. Store values of frmData in a cookie.
*******************/

function open_window(p_href)
{
var v_newwindow = '';
var v_element;


document.frmData.OptionsChanged.Value = "True";

//alert("Value = " + document.frmData.OptionsChanged.Value);

store_form_values(document.frmData);

if (!v_newwindow.closed && v_newwindow.location)
{
v_newwindow.location.href = p_href;
}
else
{
v_newwindow=window.open(p_href,'WinName',
'toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, copyhistory=no, height=400, width=500');
if (!v_newwindow.opener) v_newwindow.opener = self;
}
}

/*******************************************************************************

store_form_values(p_form)

Store values of p_form in a cookie. Parameter p_form must be of type form

*******************************************************************************/

function store_form_values(p_form)
{
var v_element;

for (var i=0; i<p_form.elements.length; i++) {
if (p_form.elements.type == &quot;text&quot;
|| p_form.elements.type == &quot;select-one&quot;
|| p_form.elements.type == &quot;hidden&quot;
|| p_form.elements.type == &quot;checkbox&quot;
|| p_form.elements.type == &quot;textarea&quot;) {
v_element = p_form.elements;
v_page_cookie[v_element.name] = v_element.value;
}
}

v_page_cookie.store();
}



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top