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

help w/ a dialog window

Status
Not open for further replies.

nshenry03

Technical User
Feb 9, 2006
60
US
I have a <input type="text"... that I would like to have filled by a popup window that accesses a mysql database to give the user valid choices

I have this script to open the window:
Code:
function myOpen() {
    	targetitem = document.getElementById("classCodeTB"); 
        dataitem = window.open("test.php","dataitem", "toolbar=no,menubar=no, scrollbars=yes"); 
        dataitem.targetitem = targetitem;		
	}

and this to return the value:

Code:
function select_item() {
	targetitem.value = document.getElementById("selectSubCategoryDD").options[document.getElementById("selectSubCategoryDD").options.selectedIndex].value;
    //alert(test);
	top.close();
    return false;	
}

this works great for a simple form w/ a drop down or text box or this or that, but I have it a little bit more complicated b/c my script refreshes the page when a user selects a category so that the subcategory drop down will be smaller

This script is:
Code:
function reload(form){
	var val=form.selectCategoryDD.options[form.selectCategoryDD.options.selectedIndex].value;
	self.location='findClassCode.php?cat=' + val ;
}

Any help or ideas would be appreciated.
 
for the return function, I needed to specify opener because it defaulted to parent...

rather than:
Code:
function select_item() {
    targetitem.value = document.getElementById("selectSubCategoryDD").options[document.getElementById("selectSubCategoryDD").options.selectedIndex].value;
    //alert(test);
    top.close();
    return false;    
}

I should have used:
Code:
function select_item() {
    opener.targetitem.value = document.getElementById("selectSubCategoryDD").options[document.getElementById("selectSubCategoryDD").options.selectedIndex].value;
    //alert(test);
    top.close();
    return false;    
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top