Hi
Ok, what I used to get the data is:
function MM_callJS(jsStr) { //v2.0
//alert("asd")
var X;
X = parent.iname.document.form.id.value;
alert(X); }
This seems to work fine but I have still got 2 problems...
1. How do I get the value for X in a
VB variable so that it can be included in the mail send code? (The mail send is VBS)
2. On the second listbox, which is populated from the DB, I am not able to return the selected value, it only returns a blank even though it is selected.
Any ideas or sugestions? Below is the code for the page in the iframe, the select box I am having trouble with is called "type" (I have created a txt box called "X" which I use for testing)
Thanks
Marnus
<body><BODY bgcolor="#CCCCCC"></body>
<%
Dim strSQL
Dim conn
Dim rstCallType, rstCallCat
Dim iRequestedID
' Some basic checking and cleaning of the input
iRequestedID = Trim(Request.QueryString("id"))
iRequestedID = Replace(iRequestedID, "'", "''")
If IsNumeric(iRequestedID) Then
iRequestedID = CInt(iRequestedID)
Else
iRequestedID = 0
End If
' The form links back to this same file passing back the id
%>
<form name="form" action="pop2.asp" method="get">
<%
value1 = request.form("Type")
' Create ADO data connection object
Set conn = Server.CreateObject("ADODB.Connection")
'Open data connection - Use this line to use Access
conn.Open "DBQ=" & Server.MapPath("DB_CallCat.mdb") & ";" & "Driver={Microsoft Access Driver (*.mdb)};", "admin", ""
' Open data connection - Our SQL Server code
'conn.Open "Provider=SQLOLEDB;Data Source=10.2.1.214;" _
'& "Initial Catalog=CallCats;Connect Timeout=15;" _
'& "Network Library=dbmssocn;", "CallCats", "password"
' Build our query for select box 1
strSQL = "SELECT * FROM CallCat ORDER BY Call_Cat;"
' Create and open recordset object using existing connection
Set rstCallType = Server.CreateObject("ADODB.Recordset")
rstCallType.Open strSQL, conn, adOpenForwardOnly, adLockOptimistic, adCmdText
' Build our drop down box of salesmen names
If Not rstCallType.EOF Then
rstCallType.MoveFirst
%>
<table width="80" border="0">
<tr>
<td>
<b>Call Category:</b>
</td>
<td>
<select name="id" onChange="javascript
:form.submit()">
<option></option>
<% ' Loop through names
Do While Not rstCallType.EOF
Response.Write "<option value="""
Response.Write rstCallType.Fields("id")
Response.Write """"
If rstCallType.Fields("id") = CInt(iRequestedID) Then
Response.Write "selected=""true"""
End If
Response.Write ">"
'Response.Write Trim(rstCallType.Fields("first_name"))
'Response.Write " "
Response.Write Trim(rstCallType.Fields("Call_Cat"))
Response.Write "</option>" & vbCrLf
' Move to next record
rstCallType.MoveNext
Loop
%>
</select>
</td>
</tr>
<%
End If
' Close ADO objects we're finished with and free DB variables
rstCallType.Close
Set rstCallType = Nothing
' If a request for a specific id comes in, then build second select box
If iRequestedID <> 0 Then
strSQL = "SELECT * FROM CallType WHERE CallCatId = " _
& iRequestedID & " ORDER BY CallType"
Set rstCallCat = Server.CreateObject("ADODB.Recordset")
rstCallCat.Open strSQL, conn, adOpenForwardOnly, adLockOptimistic, adCmdText
' Build our drop down box of the salesmen's sales
If Not rstCallCat.EOF Then
rstCallCat.MoveFirst
%>
<tr>
<td>
<b>Call Type:</b>
</td>
<td>
<select name="type" onChange="this.form.X.value = this[this.selectedIndex].value;">
<option></option>
<% ' Loop through names
Do While Not rstCallCat.EOF
Response.Write "<option>"
Response.Write Trim(rstCallCat.Fields("CallType"))
Response.Write "</option>" & vbCrLf
' Move to next record
rstCallCat.MoveNext
Loop
%>
</select>
</td>
</tr>
<%
End If
' Close ADO objects we're finished with and free DB variables
rstCallCat.Close
Set rstCallCat = Nothing
End If
' Close ADO objects we're finished with and free DB variables
conn.Close
Set conn = Nothing
%>
<tr>
<td>
<b>Priority:</b>
</td>
<td>
<select name="priority" id="priority">
<option>Please select from list</option>
<option value="1 - Critical">1 - Critical</option>
<option value="2 - Severe">2 - Severe</option>
<option value="3 - Medium">3 - Medium</option>
<option value="4 - Low">4 - Low</option>
</select>
</td>
</tr>
<tr>
<td>
<b>Transaction Code:</b>
</td>
<td>
<input name="transcode" type="text" id="transcode">
</td>
</tr>
<tr>
<td>
<b>Company Code:</b>
</td>
<td>
<input name="compcode" type="text" id="compcode" size="6" maxlength="4">
<input name="X" type="text">
</td>
</tr>
</Table>
</form>
Such is Life!