Link to home
Start Free TrialLog in
Avatar of TRACEYMARY
TRACEYMARY

asked on

Using Javascript to pass back information into a drop downlist

I have managed to do the following:

<SCRIPT>
var sColor="";              

function callDialog() {
 showModelessDialog("testcallee.asp",window,"status:false;dialogWidth:300px;dialogHeight:150px");
}

function update() {
  document.form1.oColor.value= sColor;
  document.form1.aColor.value= sColor;


}
</SCRIPT>

Text Box
<input type="text" name="oColor" value="">
Search Button
 <INPUT TYPE="button" VALUE="Search" onclick="callDialog()">


testcallee.asp
HTML>
<HEAD>
<TITLE>callee.html</TITLE>
<SCRIPT>

function getInfoAndUpdate() {
  var callerWindowObj = dialogArguments;
  callerWindowObj.sColor = oEnterColor.value;
  callerWindowObj.update();
}

function cancel() {
  var callerWindowObj = dialogArguments;
  callerWindowObj.sColor = "Yellow";
  callerWindowObj.update();
}
</SCRIPT>
</HEAD>
<BODY>
Enter your favorite color:<INPUT ID=oEnterColor><BR><BR>
<INPUT VALUE="Apply" TYPE=button onclick="getInfoAndUpdate();">
<INPUT VALUE="Ok" TYPE=button onclick="getInfoAndUpdate();window.close();">
<INPUT VALUE="Cancel" TYPE=button onclick="cancel();window.close();">
</BODY>
</HTML>

Now i would like to be able to return the value into a drop down list......
which i build from a database

<%Call CreateOption("AssetTag","select distinct ASSETTAG from ASSETTICKET WHERE ASSETTAG IS NOT NULL","ASSETTAG","ASSETTAG", request("AssetTag"))%>

<%sub CreateOption(strName,strTableOrSQL,strValue,strDisplay, strSelected)

'This subroutine expects the following parameters:
' strName is the name of option to  be created
' strTableNameOrSQL the name of table
' strValue is the field from the recordset that holds the value to be stored;
'strDisplay is the field from the recordset that will be displayed in the drop down;
'if a default value is to be selected, that is passed as strSelected. strJavaScript holds
'any event and script to be fired with that event.

dim objRSOption, strIsSelected
set objRSOption=Server.CreateObject("ADODB.RecordSet")
objRSOption.Open strTableOrSQL,dbConn

response.write("<Select Name = '" & strName & "'" & strJavaScript & ">")
response.write(vbCrLF & vbTab &  vbTab & vbTab & vbTab & vbTab & "<Option Value = ''></Option>")

Do until objRSOption.eof
     if Trim(UCase(objRSOption(strValue))) = Trim(UCase(strSelected)) then
          strIsSelected = " selected"
     else
          strIsSelected = ""
     end if
     Response.write(vbCrLF & vbTab &  vbTab & vbTab & vbTab & vbTab & "<Option" & strIsSelected & " Value ='" & objRSOption(strValue) & "'>" & objRSOption(strDisplay) & "</Option>")
     objRSOption.MoveNext
Loop
Response.write(vbCrLF & vbTab &  vbTab & vbTab & vbTab & "</Select>")

objRSOption.close
set objRSOption = Nothing

end sub%>

Possible.............to set the selected dropdown to the oColor coming in from the javascript
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

I am not sure that you can do what you are asking here. Since you call the pop up from your page, that means that the page is already rendered, so you can't pass a value to the server-side code that has already exectuted.

FtB
1) the asp subroutine function creates the select list
2) the popup appears
3) a value is returned


As you can see, 3 takes place well after 1 does.

Having said that, if you return a value from the pop up, it may be possible to reset the value of the select list using client side code.

FtB
Did you try to add the information to the array??
Avatar of TRACEYMARY
TRACEYMARY

ASKER

Arrays are a little more complex for me...............this javascript is bad enough...

I hear you fritz..
is there a way with the client.......when it comes to do it....
Okay, so how do you get the value back from your popup? To what variable is it stored? Also, do you get the text or the value back, i.e., how does this relate to the select list that you want to manipulate?

FtB
TRACEMARY,
You won't be able to do it with JAVASCRIPT. Here is the deal, I have done it through JSP. I can give you idea how to do it, and may be you can try doing it with ASP.

to get information on JSP follow the link..
https://www.experts-exchange.com/questions/21119382/Adding-table-on-a-jsp-URGENT.html

Remember same loginc will be used to update list dynamically..
-Raj
>>You won't be able to do it with JAVASCRIPT.<<

Are you sure? If you can pass a value back to the page, then we could do something like:

document.forms[0].elements['AssetTag'].selectedIndex = intIndexToSelect;

Or if we have to, we can iterate through the select list with client-side code until we find the match and then set the selected index then.

FtB
We did that in TRACEYMARY's last question
https://www.experts-exchange.com/questions/21157994/Pass-information-from-one-page-to-another.html
Problem is How do we update list dynamically? We can save value from other page in array that's not a problem. But display array values ???
Let me know if need help in adding the values to array, and may be "FtB" cam figure out something to display array to the option list..
-Raj
Ok....this is getting hard but now im geared to getting it to work.

First Page   a1.asp

<form name="form1" method="GET" action="assetticket_view.asp">
  <table width="100%"  border="0">
    <tr>
      <td width="29%"><span class="style3">Asset Tag </span></td>
      <td width="71%">
        <p>
<input name=t>
<input type=button value=choose onclick=window.open("assetsearch.asp")>
       

assetsearch.asp

I added
<a href='javascript:window.opener.document.form1.t.value=3;self.close()'>return 3></a>

and it returns 3 to the page ......in my correct textbox....called t...great..

Now if i do it to return a recordset value

td>
<%response.write rs("ASSETTAG")  %>
<a href='javascript:window.opener.document.form1.t.value=<%=rs("ASSETTAG")%>;self.close()'>return 3></a>
</td>

I do not get my recordset value...(I see in the browser window it selecting value but on return i get
16384 instead of my recordset value 040000

and 16413 instead of value 040035

That is odd..............(any reason for this)...

Once working i can get on to the Select....part

Cheers




       
So, is the idea here not to select an item, but rather, to add an item to the list? If so, we can append a pair to the select list using client-side scripting.

FtB
Well the idea is
... the user can select from the drop down list
....or if want to get more information as do not know the number then go and use search
   then when that values returns
   put it in the position where the drop down list is..as a selected value.

just as if they had used the drop down feature....
(so that my program only looks at one place for the value and that be in the select list.)

Okay, that should be fine then. Once you get the value from the window, we can use it to set the selected property of the select list. Will you be passing the value or the text for the select list from the popup to the page?

FtB
I might have a good news soon...
I got item inserted to the list now only problem is to get it selected...
ASKER CERTIFIED SOLUTION
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oops, that should be:

             objSel = document.forms[0].elements['AssetTag']
               intLength = objSel.length;
               objSel.options[intLength]=new Option;
               objSel.options[intLength].value = strValue;
               objSel.options[intLength].text = strText;
               objSel.selectedIndex = intLength

Perfect
here is the working code

caller.html
+++++++++++++++++++++++++++
<HEAD>
<TITLE>DialogArguments Example</TITLE>
<SCRIPT>
var sColor="";              

function callDialog() {
 showModelessDialog("callee.html",window,"status:false;dialogWidth:300px;dialogHeight:150px");
}

function update() {
  fbox=sColor;
  tbox = document.form1.list1;
<!-- Begin
sortitems = 1;  // Automatically sort items within lists? (1 or 0)

var no = new Option();
no.value = fbox;
no.text = fbox;
tbox.options[tbox.options.length] = no;
tbox.selectedIndex = no;
fbox= "";
if (sortitems) SortD(tbox);
}

function SortD(box)  {
var temp_opts = new Array();
var temp = new Object();
for(var i=0; i<box.options.length; i++)  {
temp_opts[i] = box.options[i];
}
for(var x=0; x<temp_opts.length-1; x++)  {
for(var y=(x+1); y<temp_opts.length; y++)  {
if(temp_opts[x].text > temp_opts[y].text)  {
temp = temp_opts[x].text;
temp_opts[x].text = temp_opts[y].text;
temp_opts[y].text = temp;
      }
   }
}
for(var i=0; i<box.options.length; i++)  {
box.options[i].value = temp_opts[i].value;
box.options[i].text = temp_opts[i].text;
   }
}
// End -->
</script>
</HEAD>
<BODY>
<form name="form1">
<input name="txtAssetTag" type="text" id="txtAssetTag">      
 
<select multiple size="5" name="list1">
<option value="11"> item 1.1 </option>
<option value="12"> item 1.2 </option>
<option value="13"> item 1.3 </option>
</select>
<INPUT TYPE="button" VALUE="Add Item" onclick="callDialog()">
</form>
</BODY>
</HTML>
++++++++++++++++++++++++++++++

callee.html
===========================
<HTML>
<HEAD>
<TITLE>callee.html</TITLE>
<SCRIPT>
function getInfoAndUpdate() {
  var callerWindowObj = dialogArguments;
  callerWindowObj.sColor = oEnterColor.value;
  callerWindowObj.update();
}
function cancel() {
  var callerWindowObj = dialogArguments;
  callerWindowObj.sColor = "No Item";
  callerWindowObj.update();
}
</SCRIPT>
</HEAD>
<BODY>
Enter your item:<INPUT ID=oEnterColor><BR><BR>

<INPUT VALUE="Ok" TYPE=button onclick="getInfoAndUpdate();window.close();">
<INPUT VALUE="Cancel" TYPE=button onclick="cancel();window.close();">
</BODY>
</HTML>
========================
-Raj
Ok i made a simple program.

a1.htm

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!-- #INCLUDE FILE="adovbs.Inc" -->
<html>
<head>

<title>Tickets</title>
<link href="CSS/Accessible_Design_Assets.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style3 {color: #336699; font-weight: bold; }
-->
</style>
</head>

<body>



<form name="form1" method="GET" action="a1.htm">
  <table width="100%"  border="0">
    <tr>
      <td width="29%"><span class="style3">Employee </span></td>
      <td width="71%">
        <p>
<input name=t>
<input type=button value=choose onclick=window.open("assetsearch.asp")>
       
       
           
   
             
        </p></td>
</form>
   
</body>
</html>

calls
assetsearch.asp

using northwind database here of employees
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!-- #INCLUDE FILE="adovbs.Inc" -->
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Tickets</title>
<link href="CSS/Accessible_Design_Assets.css" rel="stylesheet" type="text/css">



      <%            
dim  dbConn
      set dbConn = server.createobject("adodb.Connection")
      dbConn.open Session("DATABASENORTHWIND")
    Set rs = Server.CreateObject("ADODB.Recordset")
 
 
 %>

<style type="text/css">
<!--
.style3 {color: #336699; font-weight: bold; }
-->
</style>
</head>

<body>

<p align="center">&nbsp;</p>
<p align="center"><strong>
<%
strSQL = "select * from Employees"
   
rs.CursorLocation = 3
rs.Open strSQL, dbConn, 3



rs.PageSize = 15   'Records per page
If Request.Querystring("page") = "" Then
  myPage = 1
Else
  myPage = Request.Querystring("page")
End If

iPages = rs.PageCount
if iPages > 0 then
      rs.AbsolutePage = myPage
else
      response.write "No Employees"
      response.end
end if

Count = 0
%>
<table border="1">
<tr bgcolor="#336699"><td><span class="BulletBackgroundColor">Employee</span></td>
</tr>
<tr>
<%Do While Count < rs.PageSize And Not rs.EOF%>
<tr><td><%response.write rs("FirstName")  %>
<%myvalue = rs("FirstName")%>
<a href='javascript:window.opener.document.form1.t.value=3;self.close()'>return 3></a>
</td>
  <%Count = Count + 1
  rs.MoveNext
Loop
%>
</table>
<%
If CInt(myPage) > 1 Then
%>
  <a href="assetsearch.asp.asp?page=<%= myPage -1 %>">Prev</a>
<%
End If
If rs.PageCount > 1 Then
  For i = 1 To rs.PageCount
%>
  <a href="assetsearch.asp?page=<%= i %>"><%= i %></a>
<%
  Next
End If

If CInt(myPage) < CInt(iPages) Then
%>
  <a href="assetsearch.asp?page=<%= myPage +1 %>">Next</a>
<%
End If
%>

      



      
      
</body>
</html>



This returns the 3 but when i do
<a href='javascript:window.opener.document.form1.t.value=3;self.close()'>return 3></a>

<a href='javascript:window.opener.document.form1.t.value=<%=rs("FirstName")%>;self.close()'>return 3></a>

I get javascript error.

Need to get this bit working then go to the complex select part.

Phew................
TRACEYMARY, Is that what you are looking for....
ok just got it working with the recordset listing the values.

<HEAD>
<TITLE>DialogArguments Example</TITLE>
<SCRIPT>
var sColor="";              

function callDialog() {
 showModelessDialog("callee_a.asp",window,"status:false;dialogWidth:300px;dialogHeight:150px");
}

function update() {
  fbox=sColor;
  tbox = document.form1.list1;
<!-- Begin
sortitems = 1;  // Automatically sort items within lists? (1 or 0)

var no = new Option();
no.value = fbox;
no.text = fbox;
tbox.options[tbox.options.length] = no;
tbox.selectedIndex = no;
fbox= "";
if (sortitems) SortD(tbox);
}

function SortD(box)  {
var temp_opts = new Array();
var temp = new Object();
for(var i=0; i<box.options.length; i++)  {
temp_opts[i] = box.options[i];
}
for(var x=0; x<temp_opts.length-1; x++)  {
for(var y=(x+1); y<temp_opts.length; y++)  {
if(temp_opts[x].text > temp_opts[y].text)  {
temp = temp_opts[x].text;
temp_opts[x].text = temp_opts[y].text;
temp_opts[y].text = temp;
      }
   }
}
for(var i=0; i<box.options.length; i++)  {
box.options[i].value = temp_opts[i].value;
box.options[i].text = temp_opts[i].text;
   }
}
// End -->
</script>

<%            
dim  dbConn
      set dbConn = server.createobject("adodb.Connection")
      dbConn.open Session("DATABASENORTHWIND")
    Set rs = Server.CreateObject("ADODB.Recordset")
 
 
 %>
</HEAD>
<BODY>
<form name="form1">
<input name="txtAssetTag" type="text" id="txtAssetTag">      
 <%Call CreateOption("list1","select distinct FIRSTNAME from EMPLOYEES ","FIRSTNAME","FIRSTNAME", request("FIRSTNAME"))%>
<INPUT TYPE="button" VALUE="Add Item" onclick="callDialog()">
</form>

<%sub CreateOption(strName,strTableOrSQL,strValue,strDisplay, strSelected)

'This subroutine expects the following parameters:
' strName is the name of option to  be created
' strTableNameOrSQL the name of table
' strValue is the field from the recordset that holds the value to be stored;
'strDisplay is the field from the recordset that will be displayed in the drop down;
'if a default value is to be selected, that is passed as strSelected. strJavaScript holds
'any event and script to be fired with that event.

dim objRSOption, strIsSelected
set objRSOption=Server.CreateObject("ADODB.RecordSet")
objRSOption.Open strTableOrSQL,dbConn

response.write("<Select Name = '" & strName & "'" & strJavaScript & ">")
response.write(vbCrLF & vbTab &  vbTab & vbTab & vbTab & vbTab & "<Option Value = ''></Option>")

Do until objRSOption.eof
     if Trim(UCase(objRSOption(strValue))) = Trim(UCase(strSelected)) then
          strIsSelected = " selected"
     else
          strIsSelected = ""
     end if
     Response.write(vbCrLF & vbTab &  vbTab & vbTab & vbTab & vbTab & "<Option" & strIsSelected & " Value ='" & objRSOption(strValue) & "'>" & objRSOption(strDisplay) & "</Option>")
     objRSOption.MoveNext
Loop
Response.write(vbCrLF & vbTab &  vbTab & vbTab & vbTab & "</Select>")

objRSOption.close
set objRSOption = Nothing

end sub%>
</BODY>
</HTML>


Now...it returns to the drop down great......................(is there a way to make that the first visible..)...
that be great...

Then the calling program.....................(i need to pass from another paging list of records)..

but so far that pretty dam good programming...



Ok got both programs here:


<HEAD>
<TITLE>DialogArguments Example</TITLE>
<SCRIPT>
var sColor="";              

function callDialog() {
 showModelessDialog("callee_a.asp",window,"status:false;dialogWidth:300px;dialogHeight:150px");
}

function update() {
  fbox=sColor;
  tbox = document.form1.list1;
<!-- Begin
sortitems = 1;  // Automatically sort items within lists? (1 or 0)

var no = new Option();
no.value = fbox;
no.text = fbox;
tbox.options[tbox.options.length] = no;
tbox.selectedIndex = no;
fbox= "";
if (sortitems) SortD(tbox);
}

function SortD(box)  {
var temp_opts = new Array();
var temp = new Object();
for(var i=0; i<box.options.length; i++)  {
temp_opts[i] = box.options[i];
}
for(var x=0; x<temp_opts.length-1; x++)  {
for(var y=(x+1); y<temp_opts.length; y++)  {
if(temp_opts[x].text > temp_opts[y].text)  {
temp = temp_opts[x].text;
temp_opts[x].text = temp_opts[y].text;
temp_opts[y].text = temp;
      }
   }
}
for(var i=0; i<box.options.length; i++)  {
box.options[i].value = temp_opts[i].value;
box.options[i].text = temp_opts[i].text;
   }
}
// End -->
</script>

<%            
dim  dbConn
      set dbConn = server.createobject("adodb.Connection")
      dbConn.open Session("DATABASENORTHWIND")
    Set rs = Server.CreateObject("ADODB.Recordset")
 
 
 %>
</HEAD>
<BODY>
<form name="form1">
<input name="txtAssetTag" type="text" id="txtAssetTag">      
 <%Call CreateOption("list1","select distinct FIRSTNAME from EMPLOYEES ","FIRSTNAME","FIRSTNAME", request("FIRSTNAME"))%>
<INPUT TYPE="button" VALUE="Add Item" onclick="callDialog()">
</form>

<%sub CreateOption(strName,strTableOrSQL,strValue,strDisplay, strSelected)

'This subroutine expects the following parameters:
' strName is the name of option to  be created
' strTableNameOrSQL the name of table
' strValue is the field from the recordset that holds the value to be stored;
'strDisplay is the field from the recordset that will be displayed in the drop down;
'if a default value is to be selected, that is passed as strSelected. strJavaScript holds
'any event and script to be fired with that event.

dim objRSOption, strIsSelected
set objRSOption=Server.CreateObject("ADODB.RecordSet")
objRSOption.Open strTableOrSQL,dbConn

response.write("<Select Name = '" & strName & "'" & strJavaScript & ">")
response.write(vbCrLF & vbTab &  vbTab & vbTab & vbTab & vbTab & "<Option Value = ''></Option>")

Do until objRSOption.eof
     if Trim(UCase(objRSOption(strValue))) = Trim(UCase(strSelected)) then
          strIsSelected = " selected"
     else
          strIsSelected = ""
     end if
     Response.write(vbCrLF & vbTab &  vbTab & vbTab & vbTab & vbTab & "<Option" & strIsSelected & " Value ='" & objRSOption(strValue) & "'>" & objRSOption(strDisplay) & "</Option>")
     objRSOption.MoveNext
Loop
Response.write(vbCrLF & vbTab &  vbTab & vbTab & vbTab & "</Select>")

objRSOption.close
set objRSOption = Nothing

end sub%>
</BODY>
</HTML>





--------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<HTML>
<HEAD>
<TITLE>callee.html</TITLE>
<SCRIPT>
function getInfoAndUpdate() {
  var callerWindowObj = dialogArguments;
  callerWindowObj.sColor = oEnterColor.value;
  callerWindowObj.update();
}
function cancel() {
  var callerWindowObj = dialogArguments;
  callerWindowObj.sColor = "No Item";
  callerWindowObj.update();
}
</SCRIPT>
</HEAD>
<BODY>
Enter your item:<INPUT ID=oEnterColor><BR><BR>

<INPUT VALUE="Ok" TYPE=button onclick="getInfoAndUpdate();window.close();">
<INPUT VALUE="Cancel" TYPE=button onclick="cancel();window.close();">

      <%            
dim  dbConn
      set dbConn = server.createobject("adodb.Connection")
      dbConn.open Session("DATABASENORTHWIND")
    Set rs = Server.CreateObject("ADODB.Recordset")
 
 
 %>

<style type="text/css">
<!--
.style3 {color: #336699; font-weight: bold; }
-->
</style>
</head>

<body>

<p align="center">&nbsp;</p>
<p align="center"><strong>
<%
strSQL = "select * from Employees"
   
rs.CursorLocation = 3
rs.Open strSQL, dbConn, 3



rs.PageSize = 15   'Records per page
If Request.Querystring("page") = "" Then
  myPage = 1
Else
  myPage = Request.Querystring("page")
End If

iPages = rs.PageCount
if iPages > 0 then
      rs.AbsolutePage = myPage
else
      response.write "No Employees"
      response.end
end if

Count = 0
%>
<table border="1">
<tr bgcolor="#336699"><td><span class="BulletBackgroundColor">Employee</span></td>
</tr>
<tr>
<%Do While Count < rs.PageSize And Not rs.EOF%>
<tr><td><%response.write rs("FirstName")  %>
<%myvalue = rs("FirstName")%>
<a href='javascript:window.opener.document.form1.t.value=<%=rs("FirstName")%>;self.close()'>return 3></a>
</td>
  <%Count = Count + 1
  rs.MoveNext
Loop
%>
</table>
<%
If CInt(myPage) > 1 Then
%>
  <a href="assetsearch.asp.asp?page=<%= myPage -1 %>">Prev</a>
<%
End If
If rs.PageCount > 1 Then
  For i = 1 To rs.PageCount
%>
  <a href="assetsearch.asp?page=<%= i %>"><%= i %></a>
<%
  Next
End If

If CInt(myPage) < CInt(iPages) Then
%>
  <a href="assetsearch.asp?page=<%= myPage +1 %>">Next</a>
<%
End If
%>

      



      
      
</body>

</HTML>


If i do the add ...name in the enter box it works great.........

I like to be able to select from the pull down list of records in the child page and that value to return into the select box.
and be the first one..

Wow looking like there is light at the end of a tunnel.

Didn't get you, go again... in simple words...
thanks... and thanks to FtB
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Smiles ok...getting carried away with myself over here

2nd Page.
I display a list of records from database
so rather than type in the text box...enter your ..

you select the record in the paging section

So im trying to make the following be the value which is from database list rather than the text box field value

<input ID=oEnterColor value="<%=rs("FirstName")%>">
<INPUT VALUE="Ok" TYPE=button onclick="getInfoAndUpdate();window.close();">

instead of
Enter your item:<INPUT ID=oEnterColor><BR><BR>

<INPUT VALUE="Ok" TYPE=button onclick="getInfoAndUpdate();window.close();">
<INPUT VALUE="Cancel" TYPE=button onclick="cancel();window.close();">


It works but it returns value undefined......

Cheers
but I guess this way you will be getting only on value, you said you want to select from the list, something like this:

<HTML>
<HEAD>
<TITLE>callee.html</TITLE>
<SCRIPT>
function getInfoAndUpdate() {
  var callerWindowObj = dialogArguments;
  callerWindowObj.sValue = oEnterColor.value;
      callerWindowObj.sText = oEnterColor.text;
  callerWindowObj.update();
}
function cancel() {
  var callerWindowObj = dialogArguments;
  callerWindowObj.sValue = "";
      callerWindowObj.sText = "";
  callerWindowObj.update();
}
</SCRIPT>
</HEAD>
<BODY>
<select name="oEnterColor">
<option value="1">One  // these options will be coming from database....
<option value="2">Two
<option value="3">Three
</select>

<INPUT VALUE="Ok" TYPE=button onclick="getInfoAndUpdate();window.close();">
<INPUT VALUE="Cancel" TYPE=button onclick="cancel();window.close();">
</BODY>
</HTML>

===============
I am getting undefined too... but it will work, keep trying.. I will be back soon...
Bye
Not a problem thanks
Do you have a link that I can look at?

FtB
Ok i managed to get it to work using the

<a href="javascript:window.opener.document.form1.category.value='<%=rs("CATEGORY_ID")%>';self.close();"><%=rs("CATEGORY_ID")%></a>

and returning to this
 <input name=category>
<input type=button value=choose onclick=window.open("call_search.asp")>

The other javascript part is really good raj......but i think i have to get up to speed on javascript really quickly.

So i use the this example as it works....................and is easy to amend if i get any errors.
As to populate the list drop down ..........(thats a luxury).

So i keep working on the other part.......................but for now got a work around.

Thanks ........i close out the bug....

If i get a work around for this: using modal
<HEAD>
<TITLE>DialogArguments Example</TITLE>
<SCRIPT>
var sColor="";              

function callDialog() {
 showModelessDialog("callee_a.asp",window,"status:false;dialogWidth:300px;dialogHeight:150px");
}

function update() {
  fbox=sColor;
  tbox = document.form1.list1;
<!-- Begin
sortitems = 1;  // Automatically sort items within lists? (1 or 0)

var no = new Option();
no.value = fbox;
no.text = fbox;
tbox.options[tbox.options.length] = no;
tbox.selectedIndex = no;
fbox= "";
if (sortitems) SortD(tbox);
}

function SortD(box)  {
var temp_opts = new Array();
var temp = new Object();
for(var i=0; i<box.options.length; i++)  {
temp_opts[i] = box.options[i];
}
for(var x=0; x<temp_opts.length-1; x++)  {
for(var y=(x+1); y<temp_opts.length; y++)  {
if(temp_opts[x].text > temp_opts[y].text)  {
temp = temp_opts[x].text;
temp_opts[x].text = temp_opts[y].text;
temp_opts[y].text = temp;
      }
   }
}
for(var i=0; i<box.options.length; i++)  {
box.options[i].value = temp_opts[i].value;
box.options[i].text = temp_opts[i].text;
   }
}
// End -->
</script>

<%            
dim  dbConn
      set dbConn = server.createobject("adodb.Connection")
      dbConn.open Session("DATABASENORTHWIND")
    Set rs = Server.CreateObject("ADODB.Recordset")
 
 
 %>
</HEAD>
<BODY>
<form name="form1">
<input name="txtAssetTag" type="text" id="txtAssetTag">      
 <%Call CreateOption("list1","select distinct FIRSTNAME from EMPLOYEES ","FIRSTNAME","FIRSTNAME", request("FIRSTNAME"))%>
<INPUT TYPE="button" VALUE="Add Item" onclick="callDialog()">
</form>

<%sub CreateOption(strName,strTableOrSQL,strValue,strDisplay, strSelected)

'This subroutine expects the following parameters:
' strName is the name of option to  be created
' strTableNameOrSQL the name of table
' strValue is the field from the recordset that holds the value to be stored;
'strDisplay is the field from the recordset that will be displayed in the drop down;
'if a default value is to be selected, that is passed as strSelected. strJavaScript holds
'any event and script to be fired with that event.

dim objRSOption, strIsSelected
set objRSOption=Server.CreateObject("ADODB.RecordSet")
objRSOption.Open strTableOrSQL,dbConn

response.write("<Select Name = '" & strName & "'" & strJavaScript & ">")
response.write(vbCrLF & vbTab &  vbTab & vbTab & vbTab & vbTab & "<Option Value = ''></Option>")

Do until objRSOption.eof
     if Trim(UCase(objRSOption(strValue))) = Trim(UCase(strSelected)) then
          strIsSelected = " selected"
     else
          strIsSelected = ""
     end if
     Response.write(vbCrLF & vbTab &  vbTab & vbTab & vbTab & vbTab & "<Option" & strIsSelected & " Value ='" & objRSOption(strValue) & "'>" & objRSOption(strDisplay) & "</Option>")
     objRSOption.MoveNext
Loop
Response.write(vbCrLF & vbTab &  vbTab & vbTab & vbTab & "</Select>")

objRSOption.close
set objRSOption = Nothing

end sub%>
</BODY>
</HTML>

-----
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<HTML>
<HEAD>
<TITLE>callee.html</TITLE>
<SCRIPT>
function getInfoAndUpdate() {
  var callerWindowObj = dialogArguments;
  callerWindowObj.sColor = oEnterColor.value;
  callerWindowObj.update();
}
function cancel() {
  var callerWindowObj = dialogArguments;
  callerWindowObj.sColor = "No Item";
  callerWindowObj.update();
}
</SCRIPT>
</HEAD>
<BODY>


<INPUT VALUE="Ok" TYPE=button onclick="getInfoAndUpdate();window.close();">
<INPUT VALUE="Cancel" TYPE=button onclick="cancel();window.close();">

      <%            
dim  dbConn
      set dbConn = server.createobject("adodb.Connection")
      dbConn.open Session("DATABASENORTHWIND")
    Set rs = Server.CreateObject("ADODB.Recordset")
 
 
 %>

<style type="text/css">
<!--
.style3 {color: #336699; font-weight: bold; }
-->
</style>

</head>

<body>

<p align="center">&nbsp;</p>
<p align="center"><strong>
<%
strSQL = "select * from Employees"
   
rs.CursorLocation = 3
rs.Open strSQL, dbConn, 3



rs.PageSize = 15   'Records per page
If Request.Querystring("page") = "" Then
  myPage = 1
Else
  myPage = Request.Querystring("page")
End If

iPages = rs.PageCount
if iPages > 0 then
      rs.AbsolutePage = myPage
else
      response.write "No Employees"
      response.end
end if

Count = 0
%>
<table border="1">
<tr bgcolor="#336699"><td><span class="BulletBackgroundColor">Employee</span></td>
</tr>
<tr>
<%Do While Count < rs.PageSize And Not rs.EOF%>
<tr><td><%response.write rs("FirstName")  %>
<%myvalue = rs("FirstName")%>


  <input ID=oEnterColor value="<%=rs("FirstName")%>">
<INPUT VALUE="Ok" TYPE=button onclick="getInfoAndUpdate();window.close();">


<a href='javascript:window.opener.document.form1.t.value=<%=rs("FirstName")%>;self.close()'>return 3></a>
</td>
  <%Count = Count + 1
  rs.MoveNext
Loop
%>
</table>
<%
If CInt(myPage) > 1 Then
%>
  <a href="assetsearch.asp.asp?page=<%= myPage -1 %>">Prev</a>
<%
End If
If rs.PageCount > 1 Then
  For i = 1 To rs.PageCount
%>
  <a href="assetsearch.asp?page=<%= i %>"><%= i %></a>
<%
  Next
End If

If CInt(myPage) < CInt(iPages) Then
%>
  <a href="assetsearch.asp?page=<%= myPage +1 %>">Next</a>
<%
End If
%>

      



      
      
</body>

</HTML>


I post to this .....when i get that working
           
Are you getting the List (option) values from the database for second page(child). If so work on displaying all values to the drop down list some thing like:

<select name = "oEnterValue">

>query and get resultset
>check for the end of rs i.e. loop
>get the value i.e. myvalue = rs("FirstName")
<option value = <=%myvalue%>><%myvalue%></option>
repeat untill get all values.
</select>

do this and let me know if you are able to display all values in the drop down box..

-Raj
Once you are able to get that working then use this. I got this one working with drop down list on child page..

<HTML>
<HEAD>
<TITLE>callee.html</TITLE>
<SCRIPT>
function getInfoAndUpdate() {
  var callerWindowObj = dialogArguments;
  callerWindowObj.sColor = oEnterColor.value;    
  callerWindowObj.update();
}
function cancel() {
  var callerWindowObj = dialogArguments;
  callerWindowObj.sColor = "";
      callerWindowObj.update();
}
</SCRIPT>
</HEAD>
<BODY>
<select name="oEnterColor">  
<option value="One">One</option>
<option value="Two">Two</option>
<option value="Three">Three</option>
</select>

<INPUT VALUE="Ok" TYPE=button onclick="getInfoAndUpdate();window.close();">
<INPUT VALUE="Cancel" TYPE=button onclick="cancel();window.close();">
</BODY>
</HTML>
===================

drop down part will be replaced with your working part i.e.

<select name = "oEnterValue">
<%
>query and get resultset
>check for the end of rs i.e. loop
>get the value i.e. myvalue = rs("FirstName") %>
<option value = <=%myvalue%>><%=myvalue%></option>
<%repeat untill get all values.%>

</select>
=========================
This will work...
Thanks Dr.  Fairfield, if you didn't have question about being this done with JavaScript, we would have not tried..
Happy to help but you did most of the heavy lifting.

Doc (a.ka. FtB)

raj3060 just tried it....works a treat............

Javascript is pretty neat and powerful ......never knew it ......

So for me to learn its just "javascript" thats whats i need to get book or course on

I appreciate you sticking with a newbie in javascript here..
Now weekend i can take code home and go over it.

Cheers
One last question.

What application you using to write your javascript in...

So that you see the object.x.come up

like when i type in response.    i get promted with list of values whilst typing

cheers
You can write in Note pad or any text editor. Nothing special is required. The only problem with JavaScript is that if you rely on it, and the person has it disabled in the browser, then you may find yourself in trouble.

FtB
FtB is right, you can use any free editors available out there, I use HTMLKit, it's pretty neat, it has a nice feature that checks your code for any error, and or completes your code if you forgot something somewhere in the code. Doc is right about JavaScript too, because it is not compatible on all browsers, and acts real funky sometimes. I try to stay away from it as much as I can, because stuff you can do with JavaScript you can do with ASP or JSP too, and that's more reliable.
Stuff we did is not that easy, because I tried to do something like that before, could not do it. I learnt something new too.
You are welcome, and feel free to ask any question in future.
Have a nice weekend to you and FtB.
-raj