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

pop-up search? 1

Status
Not open for further replies.

CGreenMTU

Programmer
May 27, 2004
61
US
I need some help. I was wondering if there was anyway to create a search pop-up box which would allow you to search a database for a certain value in a certain field. For example, I have a web form of text boxes which display records from a database. I'd like to have a pop-up which would allow the user to search for a particular Claim Number, then fill the text boxes based on that claim number....

is there anyway to do this?
thanks
 
CG: Probably a number of ways you could do this; I carry out something similar with the user opening up a pop-up window and entering new values, the pop-up is closed, and the original form forced to re-posts with the new values. You could probably adapt this technique.

In the original form the code necessary to open up the pop-up aspx page goes as follows:

Code:
..pop-up openend with a button:
<INPUT TYPE="button" VALUE="Y1" onClick="javascript:getY1();" style="font-size: 14px; font-weight: bold; color: #0000FF;" width="28px">
...you could use an dot NET button here and add the javascript attribute. The javascript "getY1" reads as follows (maintained in a *.js file):
Code:
function getY1(){   
 var strPg;
 strPg = "setY1.aspx?Y1Max=" + document.forms["frmChemHist"].elements["txtY1Max"].value + "&Y1Min=" + document.forms["frmChemHist"].elements["txtY1Min"].value + "&Y1Int=" + document.forms["frmChemHist"].elements["txtY1Int"].value
 ChildWindow = window.open(strPg , 'newWinY', "width=210,height=250,top=200,left=320,toolbars=no,scrollbars=no,status=no,resizable=no");    
}
Note that two textbox values are carried as querystrings to the pop-up aspx page.

On close of the pop-up window the following javascript is executed from the pop-up aspx page:
Code:
<script language="Javascript">
function ReturnY1(Y1Max, Y1Min, Y1Int){
var Y1Max;
var Y1Min;
var Y1Int;
window.opener.document.forms["frmChemHist"].elements["txtY1Max"].value = Y1Max;
window.opener.document.forms["frmChemHist"].elements["txtY1Min"].value = Y1Min;
window.opener.document.forms["frmChemHist"].elements["txtY1Int"].value = Y1Int;
window.opener.document.forms["frmChemHist"].submit();
window.close();
}      
</script>

Note that the ".submit" portion of the code causes the original page to "post-back". In your situation you'll want to transfer the new "ID" so that your page posts back and displays the appropriate records. Note that I am assigning values to the original form in the pop-up's javascript. Hope this helps...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top