HI,
I am new to Java Script and am trying to incorporate it into my asp page so that when a user clicks on a dynamic list box, the information for the item they clicked on appears in text boxes. I can make all of the lines in the following function work except the fact that the vbscript does not seem to recognize articleid in the select statement. Any ideas? Thanks for your help. Note that below the script for the function is the code for the list box.
function Fillboxes()
{
articleid = document.frmArticles.select.value
<%
set GetArticle = Server.CreateObject("ADODB.Recordset"
GetArticle.ActiveConnection = MM_enerchihealth_STRING
GetArticle.Source = "SELECT * FROM dbo.tblArticle where fldArticleNum = " & articleid
GetArticle.CursorType = 0
GetArticle.CursorLocation = 2
GetArticle.LockType = 3
GetArticle.Open()
GetArticle_numRows = 0
%>
document.frmInsert.txtTitle.value = "<%=(GetArticle.Fields.Item("fldTitle".Value)%>";
}
</SCRIPT>
'This is the code for the list box:
<select name="select" size="6" onClick="Fillboxes()">
<%
While (NOT GetArticles.EOF)
%>
<option value="<%=(GetArticles.Fields.Item("fldArticleNum".Value)%>"><%=(GetArticles.Fields.Item("fldTitle".Value)%></option>
<%
GetArticles.MoveNext()
Wend
If (GetArticles.CursorType > 0) Then
GetArticles.MoveFirst
Else
GetArticles.Requery
End If
%>
I am new to Java Script and am trying to incorporate it into my asp page so that when a user clicks on a dynamic list box, the information for the item they clicked on appears in text boxes. I can make all of the lines in the following function work except the fact that the vbscript does not seem to recognize articleid in the select statement. Any ideas? Thanks for your help. Note that below the script for the function is the code for the list box.
function Fillboxes()
{
articleid = document.frmArticles.select.value
<%
set GetArticle = Server.CreateObject("ADODB.Recordset"
GetArticle.ActiveConnection = MM_enerchihealth_STRING
GetArticle.Source = "SELECT * FROM dbo.tblArticle where fldArticleNum = " & articleid
GetArticle.CursorType = 0
GetArticle.CursorLocation = 2
GetArticle.LockType = 3
GetArticle.Open()
GetArticle_numRows = 0
%>
document.frmInsert.txtTitle.value = "<%=(GetArticle.Fields.Item("fldTitle".Value)%>";
}
</SCRIPT>
'This is the code for the list box:
<select name="select" size="6" onClick="Fillboxes()">
<%
While (NOT GetArticles.EOF)
%>
<option value="<%=(GetArticles.Fields.Item("fldArticleNum".Value)%>"><%=(GetArticles.Fields.Item("fldTitle".Value)%></option>
<%
GetArticles.MoveNext()
Wend
If (GetArticles.CursorType > 0) Then
GetArticles.MoveFirst
Else
GetArticles.Requery
End If
%>