The Dfilter.asp file is just one of the files included (with the #include directive) in Library.asp, but it is one of the most important. It lets library users search by keyword by entering a string into the txtWord input box. Users specify whether this string is to represent an item's title, author, or subject by clicking the appropriate option button. They can also choose from among audio/visual materials, books, periodicals, reference materials, and computer software.
To start the search, users click the Search button. This calls the VBScript DoSearch function:
Sub DoSearch()
Dim strSearch,optSearch,passString,newSearch
strSearch = Trim(document.all.txtWord.value)
If strSearch <> "" Then
If setCheckboxValues Then
nLastSearch = cSearch
optSearch = ChooseTypeOfSearch()
newSearch = "Yes"
passString ="search.asp?currentword=" & escape(strSearch) & "&optSearch=" & optSearch & "&newSearch=" & newSearch & "&cbAV=" & cbAVVal & "&cbBook=" & cbBookVal & "&cbPrd=" & cbPrdVal & "&cbRef=" & cbRefVal & "&cbSoft=" & cbSoftVal
document.all.ifControl.src = passString
Else
MsgBox "You must include at least one item type to search."
End If
Else
MsgBox "You must enter a search string"
End If
End Sub
First, this subroutine builds the search string (called passString) that includes search text (from the txtWord input box), the values of option buttons (title, author, subject) and check boxes (book, periodical, and so on), and an indicator of whether this a new or repeated search. The first item in passString is the name of the ASP page that is about to be invoked:
passString ="search.asp . . .
After the string is assembled, the request is sent in the following line:
document.all.ifControl.src = passString
This line changes the location (the src attribute) of the IFrame called ifControl. Immediately, code in the new source file (Search.asp) begins to be executed, using the values in passString as arguments. While this is occurring, the rest of the current page (Library.asp and its included files) remains visually static.
This approach is representative of the CML in that it uses a nondisplayed IFrame to invoke a procedure external to the ASP file, in this case the search itself in Search.asp. For more on this technique, see Using IFrames in the CML.