You are here: The ProductCart Encyclopedia » How To's » AJAX Waiting Message for Small Search Box
AJAX Waiting Message for Small Search Box
This article assumes you have already installed the optimized v3.5 search files.
1.) Open the file “pc/SmallSearchBox.asp” in a text editor.
Place the following code directly below the last line of code on the page:
<script language="JavaScript">
<!--
function pcf_CheckSearchBox() {
pcv_strTextBox = document.getElementById("smallsearchbox").value;
if (pcv_strTextBox != "") {
pcf_OpenModal2.open();
}
}
//-->
</script>
<%
'// Loading Window
Response.Write(pcf_InitializePrototype())
response.Write(pcf_ModalWindow(dictLanguage.Item(Session("language")&"_advSrca_23"), "2", 200))
%>
2.) Add the JavaScript that will initiate the Pop-Up window when you click the “Search” button.
Replace the following line of code:
<form action="showsearchresults.asp" name="search" method="get" class="pcForms">
With this line of code:
<form action="showsearchresults.asp" name="search" method="get" onSubmit="pcf_CheckSearchBox();" class="pcForms">
3.) Add basic validation so the search box only shows when a keyword has been entered.
Replace the following line of code:
<input type="Text" name="keyword" size="14" value="">
With this line of code:
<input type="Text" name="keyword" size="14" value="" id="smallsearchbox" >