Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Request("txtSearch")


Message #1 by "Anthony Delcy" <DELCYAN@l...> on Tue, 27 Feb 2001 17:59:27 -0500
if your trying to get the results of a text input in asp it's ,
    Request.Form("txtSearch").
if in Javascript,
 it would be
    document.form(0).txtsearch.value... replace foem(0) with the name of the
form that the user completes

HTH

Mark

----- Original Message -----
From: "Anthony Delcy" <DELCYAN@l...>
To: "javascript" <javascript@p...>
Sent: Tuesday, February 27, 2001 5:59 PM
Subject: [javascript] Request("txtSearch")


Hi,

I am trying to get a value from an HTML which is entered by a user. It seems
that I cannot get this value with the following line:
strFilter = Request("txtSearch").
All I am trying to do is get the user to make their own search. They type
something in the search text box and I want to pick it up and build my SQL
string and return the result in XML

The following is the function of which I am trying to pick up the search
value from the HTML text box.



<%@ Language=VBScript %>
<%
Option explicit
%>


<!--#include file="Conn.asp"-->
<!--#include file="GenFuncs.asp"-->
<%

Dim strDataXML, DQ, cnnXML


'=====================================================
'===   Set the Connection to the database         ====
'=====================================================
'To modify the database that is used, edit the conn.asp file
SetConnection cnnXML

'===============================================================
'==== Get the XML data from the specified database          ====
'===============================================================

strDataXML = GetXMLData(cnnXML, "ORACLEODBC")

'===============================================================
'==== Write the XML Data back to the client                 ====
'===============================================================
Response.Write strDataXML

'---------------------------------------------------------
' System Functions
'---------------------------------------------------------

Function GetXMLData(cnnXML, strDataType)

dim rsXML, strXML, strSQL, stStream
dim strFilter

Select Case strDataType

Case "ADO25"
        'Do somthing

Case "ORACLEODBC"
'NOTE: This can be used for "SQL7", "SQL6.5", "ACCESS" and
'anything supported by ADO 2.5

strFilter = Request("txtSearch")
if strFilter <> "" then
if strFilter = "Del" then
strSQL = "SELECT * FROM TEL_VEMPLOYEE WHERE LAST_NAME LIKE '" & "Lag" & "%'
ORDER BY LAST_NAME"
else
strSQL = "SELECT * FROM TEL_VEMPLOYEE WHERE LAST_NAME LIKE '" & strFilter &
"%' ORDER BY LAST_NAME"
end if
else
strSQL = "SELECT * FROM TEL_VEMPLOYEE WHERE LAST_NAME LIKE '" & "Del" & "%'
ORDER BY LAST_NAME"
end if
Set rsXML = cnnXML.Execute(strSQL)

strXML = ""

If Not rsXML.EOF Then
    'Create the XML Stream
Set stStream = Server.CreateObject("ADODB.Stream")
    rsXML.Save stStream, 1' adPersistXML
    strXML = stStream.ReadText

'Convert the data from the ADO2.5 format to the format
'that we use in this page
strXML = ExtractXMLdata(strXML)

End If

End Select


GetXMLData = strip(strXML)

end function


%>


  Return to Index