Gossamer Forum
Home : Products : DBMan : Customization :

Problems with my search-form

Quote Reply
Problems with my search-form
Hi to all,

I have 30 fields in my database-entries.
If I search, I (or my guests) get all of these 30 fields in my search-form to specify the search.
that is my problem. I only want to get for example 5 or 6 fields to specify my or my guests search. Also in the "sorted by"-Drop-down-Menue I want to have these 5 or 6 fields, and not the whole 30.

What do I have to do therefor?



And a second question:
I want this form with the 5 or 6 specify-fields as my advanced search-form.
My normaly search-form (on my start-page) should have only one (perhaps two) fields my guests can fill out for searching the complete database.
For example, if the fill in an "car", the search result should show all entries from the category "cars", but also the entrie from Mr. Carter.

Is this possible?

Pit (Thanx for help, and sorry for my bad english)

Quote Reply
Re: Problems with my search-form In reply to
To create a search form that is separate from your add/modify form to the following. This will be your advanced search form.

Copy all of sub html_record_form. Paste it directly below the current subroutine. You will now have two identical subroutines.

Rename the second one to sub html_search_form. Delete all of the fields you do not want your users to search by. Add a hidden field:

Code:
<input type="hidden" name="advanced" value="1">

In sub html_view_records, change

&html_record_form;

to

Code:
if ($in{'advanced'}) {
&html_search_form;
}
else {
print qq|
<table>
<tr><td>Search for:</td>
<td><INPUT TYPE="TEXT" NAME="keyword" SIZE=15 MAXLENGTH=255></td></tr></table>
|;
}

And in sub html_view_failure, change

&html_record_form(%in);

to
Code:
if ($in{'advanced'}) {
&html_search_form(%in);
}
else {
print qq|
<table>
<tr><td>Search for:</td>
<td><INPUT TYPE="TEXT" NAME="keyword" SIZE=15 MAXLENGTH=255></td></tr></table>
|;
}

You may also make similar changes in sub html_delete_search and sub html_modify_search.

Wherever you want to place link for the advanced search form, use

Code:
print qq!<a href="$db_script_link_url&view_search=1&advanced=1">Advanced Search</a>! if ($per_view);


------------------
JPD