Gossamer Forum
Home : Products : DBMan : Customization :

Two Search Screens

Quote Reply
Two Search Screens
I was wondering if it was possible to create two search screens. I need the first one to only have the option of doing a keyword search. No other options just the keyword fill in box.

On that screen I also want link that reads 'Advanced Search' which would take you to the regular DBMan search screen.

Thanks..
Quote Reply
Re: Two Search Screens In reply to
Yes, it can be done. You can add a sub-routine called advanced_search-options and put the one text keyword search field. The best thing to do is use the "Keyword Search" form, but then take out the codes for the "Matches" and "Options". For example, I have two sub-routines that I use in the html.pl file:

Codes:
---------------------------------------------
sub html_long_record_form {
# --------------------------------------------------------
# The form fields that will be displayed each time a record is
# edited (including searching). You don't want to put the
# <FORM> and </FORM tags, merely the <INPUT> tags for each field.
# The values to be displayed are in %rec and should be incorporated
# into your form. You can use &build_select_field, &build_checkbox_field
# and &build_radio_field to generate the respective input boxes. Text and
# Textarea inputs can be inserted as is. If you turn on form auto
# generation, the program will build the forms for you (all though they may
# not be as nice). See the README for more info. my (%rec) = @_;
($db_auto_generate and print &build_html_record_form(%rec) and return);
my $font = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
print qq| <p align="left"> <font face="Arial" size="3"><b>
Advanced Search Form</font></b></p>
<table border=1 cellpadding=2 cellspacing=0 width=600> <tr>
<td width=300 valign=top bgcolor="ffffcc"> <$font>
<STRONG>First Name:</STRONG> </font></td>
<td width=300 valign=top bgcolor="ffffff">
<INPUT TYPE="TEXT" NAME="First_Name" SIZE="30" MAXLENGTH="255">
</td></tr> <tr> <td width=300 valign=top bgcolor="ffffcc">
<$font> <STRONG>Last Name:</STRONG> </font></td>
<td width=300 valign=top bgcolor="ffffff">
<INPUT TYPE="TEXT" NAME="Last_Name" SIZE="30" MAXLENGTH="255">
</td></tr> <tr> <td width=300 valign=top bgcolor="ffffcc">
<$font> <STRONG>Employee Type:</STRONG> </font></td>
<td width=300 valign=top bgcolor="ffffff"> <$font>
<STRONG>Choose one of the following:</STRONG> <BR>
|; print &build_select_field ("Employee_Type", "$rec{'Employee_Type'}"); print qq|
</font> </td></tr> <td width=300 valign=top bgcolor="ffffcc">
<$font> <STRONG>Primary Location:</STRONG> </font></td>
<td width=300 valign=top bgcolor="ffffff"> <$font>
<STRONG>Choose one of the following:</STRONG> <BR>
|; print &build_select_field ("Location", "$rec{'Location'}"); print qq|
</font> </td></tr> <td width=300 valign=top bgcolor="ffffcc">
<$font> <STRONG>Academic Area:</STRONG> </font></td>
<td width=300 valign=top bgcolor="ffffff"> <$font>
<STRONG>Choose one of the following:</STRONG> <BR>
|; print &build_select_field ("AcadArea", "$rec{'AcadArea'}"); print qq|
</font> </td></tr> <tr>
<td width=300 valign=top bgcolor="ffffcc"> <$font>
<STRONG>Department/Office:</STRONG> </font></td>
<td width=300 valign=top bgcolor="ffffff"> <$font>
<STRONG>Choose one of the following:</STRONG> <BR>
|; print &build_select_field ("Department", "$rec{'Department'}"); print qq|
</font></td></tr></table> <P> <CENTER> <B>
<A HREF="$db_script_link_url&view_search=1">Simple Search</A> \|\
<A HREF="$db_script_link_url&view_keyword=1">Keyword Search</A>
</B></CENTER></font> <P> |;}
---------------------------------------------

Codes:
---------------------------------------------
sub html_short_record_form {
# --------------------------------------------------------
# The form fields that will be displayed each time a record is
# edited (including searching). You don't want to put the
# <FORM> and </FORM tags, merely the <INPUT> tags for each field.
# The values to be displayed are in %rec and should be incorporated
# into your form. You can use &build_select_field, &build_checkbox_field
# and &build_radio_field to generate the respective input boxes. Text and
# Textarea inputs can be inserted as is. If you turn on form auto
# generation, the program will build the forms for you (all though they may
# not be as nice). See the README for more info. my (%rec) = @_;
($db_auto_generate and print &build_html_record_form(%rec) and return);
my $font = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
print qq| <p align="left"> <font face="Arial" size="3"><b>
Simple Search Form</font></b></p>
<table border=1 cellpadding=2 cellspacing=0 width=600> <tr>
<td width=300 valign=top bgcolor="ffffcc"> <$font>
<STRONG>First Name:</STRONG> </font></td>
<td width=300 valign=top bgcolor="ffffff">
<INPUT TYPE="TEXT" NAME="First_Name" SIZE="30" MAXLENGTH="255">
</td></tr> <tr> <td width=300 valign=top bgcolor="ffffcc">
<$font> <STRONG>Last Name:</STRONG> </font></td>
<td width=300 valign=top bgcolor="ffffff">
<INPUT TYPE="TEXT" NAME="Last_Name" SIZE="30" MAXLENGTH="255">
</td></tr> <tr> <td width=300 valign=top bgcolor="ffffcc">
<$font> <STRONG>Academic Area:</STRONG> </font></td>
<td width=300 valign=top bgcolor="ffffff"> <$font>
<STRONG>Choose one of the following:</STRONG> <BR>
|; print &build_select_field ("AcadArea", "$rec{'AcadArea'}"); print qq|
</font> </td></tr> <tr>
<td width=300 valign=top bgcolor="ffffcc"> <$font>
<STRONG>Department/Office:</STRONG> </font></td>
<td width=300 valign=top bgcolor="ffffff"> <$font>
<STRONG>Choose one of the following:</STRONG> <BR>
|; print &build_select_field ("Department", "$rec{'Department'}"); print qq|
</font></td></tr></table> <P> <CENTER> <B>
<A HREF="$db_script_link_url&view_advanced=1">Advanced Search</A> \|\
<A HREF="$db_script_link_url&view_keyword=1">Keyword Search</A>
</CENTER></B></font> <P> |;}
---------------------------------------------

Then I insert the sub-routine into the following sub-routines (sub html_view_search and sub html_view_advanced).

You can see the example of my html.pl at:

http://www.coco.cc.az.us/cgi-bin/directory/htmlpl.txt

You can see an example of this at the following web page:

http://www.coco.cc.az.us/cgi-bin/directory/

(You will notice that I have two search screens. I used to have three screens, but I took out the Keyword form because it showed hidden fields that I didn't want it to show.)

Or you can create a static web page that includes the similar codes as in the html.pl file. For example:

Code:
---------------------------------------------
<form method="GET" action="/path/to/db.cgi">
<input type=hidden name="db"
value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
<b>Search for:</b>
<input type="text" name="keyword" size="30">
<input type="submit" name="submit" value="Go Get It">
<input type="reset" name="reset" value="Start Over">
</form>
---------------------------------------------
Yet, it might be nice to include the options for search (matches, number of matches, ascending/descending order, etc.).

Hope this helps.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us