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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window.opener works, but the value will not pass!

Status
Not open for further replies.

programmher

Programmer
May 25, 2000
235
US
G'day!

I am attempting to update the value of one field from my parent window with the value of a field in my child window.

My window.opener command appears to work (.e. I can see the value of my variable in my debugger) but when I complete the execution, a zero is what is passed.

What is happening? My code is as follows:


<form>

function SetEstimate()

{

window.opener.EstimateForm.final_estimate.value = '#final_est#';

window.close();

}

<A HREF=&quot;Javascript:SetEstimate();&quot;>

#GetEstimate.final_est#
<a>
</form>

(GetEstimate is the name of my query that executes earlier in the child form.)
 
I think I have answered my own question - the field I am updating on my parent window is a select box. Once I changed the field to a text, my update worked.

My next question is - how can I update the select/dropdown box on my parent form?
 
try this sample :

function SetEstimate() {
var myElement, i;
myElement = eval(&quot;window.opener.EstimateForm.final_estimate&quot;);
for (i = 0; i < myElement.length; i++) {
if (myElement.value == '#final_est#') {
myElement.selected = true;
}
};
window.close();
};

If you want to check on the name either than the value of your select, change the if condition with :
if (myElement.name == '#final_est#')

Hope this helps ...
 
go to child window and write
window.opener.document.formname.fieldname.value=document.formname.fieldname.value

'--description
this will pass the contents of parent to child window.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top