This topic is locked

Advanced Search

3/1/2005 12:44:34 PM
ASPRunnerPro General questions
D
Derek author

Does anyone how to remove the equals, contains, etc options from the Advanced Search ?

Sergey Kornilov admin 3/2/2005

Derek,
you can open Template Editor, create new Template, open search.asp file and replace this section

<% call WriteSearchOptions(GetEditFormat("##FIELD##"), Session("SearchOption" & strTableName & "##FIELD##")) %>


with this one:

<input type=hidden ID=SearchOption NAME=SearchOption value="Contains">


Then choose this Template in ASPRunner Pro on the Miscellaneous page.

D
Derek author 3/2/2005

I looked for the line of code in search.asp but couldn't find it. Could you please clarify.
Below is the code for search.asp
Thanks again !
Search.asp
<------------------------------------------------------------------------------------------>
<%@ Language=VBScript %>

LOGIN##

<%

If Session("UserID")="" or CheckSecurity("", "Search")<>True Then

Response.Redirect "login.asp"

End If

%>

/LOGIN##



<link REL="stylesheet" href="include/style.css" type="text/css">

<!--#include file="include/##SHORTTABLENAME##_dbconnection.asp"-->

<!--#include file="include/##SHORTTABLENAME##_variables.asp"-->

<!--#include file="include/##SHORTTABLENAME##_aspfunctions.asp"-->
<STYLE>

.vis1 { visibility:"visible" }

.vis2 { visibility:"hidden" }

</STYLE>

<script>

function ShowHideControls()

{

var i;

for (i=0;i<document.forms.frmAdmin.SearchFor2.length; ++i)

{

document.forms.frmAdmin.SearchFor2[i].className =

document.forms.frmAdmin.SearchOption[i].options.length - 2 ==

document.forms.frmAdmin.SearchOption[i].selectedIndex ? 'vis1' : 'vis2';

}

return false;

}
function OnKeyDown()

{

e = window.event;

if (e.keyCode == 13)

{

e.cancel = true;

document.forms[0].submit();

}

}
</script>
<html>

<head>

<title><% =strTableName %>: Advanced search page</title>

</head>

<body bgcolor=white onLoad="java script:document.forms[0].onkeydown = OnKeyDown; return ShowHideControls();">
<!-- search form -->
<form method="POST" action="##SHORTTABLENAME##_list.asp" name="frmAdmin">

<input type=hidden id=masterkey name=masterkey value="<%=Request.Form("masterkey")%>">
<input type="hidden" id="action" name="action" value="AdvancedSearch">
<table rows='1' cols='1' align='center' width='400' border='0'>

<tr><td align="right">
<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>

<TR><TD BGCOLOR=black align=center>
<table border=0 width=100% CELLPADDING=3 CELLSPACING=1>

<tr valign=center class=blackshade>
<td colspan=4 align=center valign=middle>

<b>Advanced Search</b> </td></tr>

ADVSEARCHFIELDS##



<!-- ##FIELD## -->

<tr class=shade>

<td><%=Label("##FIELD##")%></td>

<input type="hidden" id="FieldName" name="FieldName" value="##FIELD##">

<input type=hidden name=NeedQuotes<%= BuildFieldName("##FIELD##") %> value="<%= Request.Form("NeedQuotes" & BuildFieldName("##FIELD##")) %>">

<td>

<% call WriteSearchOptions %>

</td>

<td><input type=text size=20 name=SearchFor></td>
<td><input type=text size=20 name=SearchFor2></td>
</tr>

/ADVSEARCHFIELDS##


<tr class=blackshade><td colspan=4 align=center>

<input type=button class=button name="SearchButton" value="Search"

onClick="java script: document.forms.frmAdmin.action.value = 'AdvancedSearch';

document.forms.frmAdmin.submit();">

<input class=button type=reset value="Reset">

<input type=button class=button value="Back to list" onClick="java script: history.go(-1);">

</td></tr>

</table>
</td></tr>

</table>
</td></tr>

</table>
</form>
<%
Sub WriteSearchOptions
Response.Write "<SELECT ID=""SearchOption"" NAME=""SearchOption"" SIZE=1 onChange=""return ShowHideControls();"">" &

"<OPTION VALUE=""Contains"">Contains</option>" &


"<OPTION VALUE=""Equals"">Equals</option>" &

"<OPTION VALUE=""Starts with ..."">Starts with ...</option>" &


"<OPTION VALUE=""More than ..."">More than ...</option>" &

"<OPTION VALUE=""Less than ..."">Less than ...</option>" &


"<OPTION VALUE=""Equal or more than ..."">Equal or more than ...</option>" &

"<OPTION VALUE=""Equal or less than ..."">Equal or less than ...</option>" &


"<OPTION VALUE=""Between"">Between</option>" &

"<OPTION VALUE=""IsNull"">Empty</option>" &


"</SELECT>"
End Sub

%>

N
neeb_1954 3/3/2005

Not sure if this helps but i changed my Search.asp in template to the following and works fine
<!-- ##FIELD## -->

<tr class=shade>

<td><%=Label("##FIELD##")%></td>

<input type="hidden" id="FieldName" name="FieldName" value="##FIELD##">

<input type=hidden name=NeedQuotes<%= BuildFieldName("##FIELD##") %> value="<%= Request.Form("NeedQuotes" & BuildFieldName("##FIELD##")) %>">

<td>

<input type=hidden ID=SearchOption NAME=SearchOption value="Equals">

</td>

<td width=230>
<!--<input type=text size=20 name=SearchFor>-->

<% Response.Write BuildSearchControl("##FIELD##", Session("SearchFor1" & strTableName & "##FIELD##"),"") %>

</td>

Sergey Kornilov admin 3/3/2005

Derek,
the change I have suggested applies to ASPRunnerPro 3.1a:

http://www.asprunner.com/files/asprunnerpro31a.exe

D
Derek author 3/4/2005

Thanks Neeb 1954 and Sergey. I have tried this out and it works !