Gossamer Forum
Home : Products : DBMan : Discussions :

Changing search view page but not modify page.

Quote Reply
Changing search view page but not modify page.
This is probably very simple and been asked 100 times before but I can't seem to find the answer.

"The form fields that will be displayed each time a record is edited (including searching)."
from html.pl

The search view page and the modify page use the same Record Layout. I want them to be different, limiting the search view page fields to 2 in the search view page but leaving all fields in the modify page for editing.
Quote Reply
Re: [kingdom] Changing search view page but not modify page. In reply to
Check out LoisC's FAQ:

http://redundantcartridge.com/dbman/

There are some options there for making customized search pages.

You have several choices:

1. Create a custom page for searching.
2. Create a custom subroutine for searching.
3. Modify the existing sub so that only certain fields show up while searching.

#1 is probably the easiest to do, #3 is probably the hardest.
Quote Reply
Re: [Watts] Changing search view page but not modify page. In reply to
Thanks for that site. I have tried the method shown there

{snip}
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_search, 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

{snip}

but I am just getting:
"DBMan encountered an internal error. Please enable debugging to view"

Tried setting debug to "1" in db.cgf but that makes no difference.

Just cannot figure out why that will not work?
Quote Reply
Re: [kingdom] Changing search view page but not modify page. In reply to
Post your html.pl file as an attachment here...

(click "reply" to this message and down at the bottom of this page is a place to upload attachments).

Do you require your users to log in? If so, it may make a difference.
Quote Reply
Re: [Watts] Changing search view page but not modify page. In reply to
Thanks for you assistance, apreciated.

In the attached .pl both 'Record Layout' and 'User search minimised' have the same fields, trying to debug but its still giving the same result.

Users don't need to log on, the plan is for an open to view db that can be updated online via the secure log in.

If is exactly whats required only to many search fields for users. All that is reguired is the department drop down, which allows them to find everything related to that department and the general search box.

The full working version with all fields is here http://www.centralwebs.co.uk/...lt&view_search=1
Quote Reply
Re: [kingdom] Changing search view page but not modify page. In reply to
OPPPPS going nuts, forgot to attach the file
Quote Reply
Re: [kingdom] Changing search view page but not modify page. In reply to
I tried the link to the custom search form and it seems to be working:

http://www.centralwebs.co.uk/cgi-bin/dbarvill/db.cgi?db=default&uid=default&view_search=1&advanced=1

Now you can just modify it to only include the fields you want to show.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Changing search view page but not modify page. In reply to
No!

The current html.pl script is my default (before I started trying to make the changes.)

The form you see is the same as for search, its the same page.

eg. this link returns the same page
http://www.centralwebs.co.uk/...;anythingcangohere=1

seems anything can go after the search=1 but defaults to the first one.

I still need help on this.
Thanks for your interest.
Quote Reply
Re: [kingdom] Changing search view page but not modify page. In reply to
Remove this line (in red) from your html.pl - you have it in there twice and the one in red is causing your problem.

sub html_record {
##########################################################
## User search minimised ##
##########################################################

sub html_search_form {
# --------------------------------------------------------
# User search page - minimised search
#
Quote Reply
Re: [Watts] Changing search view page but not modify page. In reply to
Thanks but it's still not working.

I have changed the "Advanced search Page" to include only the field I want, checked all the steps mentioned in the [siped] doc posted below and attached a copy of htmp.pl here

This html.pl is now running here
http://www.centralwebs.co.uk/...lt&view_search=1

[snip]

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_search, 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);
------------------
[snip]
Quote Reply
Re: [kingdom] Changing search view page but not modify page. In reply to
html.pl attached
Quote Reply
Re: [kingdom] Changing search view page but not modify page. In reply to
opps html.pl attachment
Quote Reply
Re: [kingdom] Changing search view page but not modify page. In reply to
If you include the &advance=1 to the end of your link it is just showing the department field.

http://www.centralwebs.co.uk/cgi-bin/dbarvill/db.cgi?db=default&uid=default&view_search=1&advanced=1

Unless you add this call via the link it will default to the keyword search. Both version are displaying.


If you don't want the page to include the other search options remove or comment out:

&html_search_options;

|;
# &html_search_options;
print qq|

Am I not understanding what the problem is or does it now work as it should?

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Changing search view page but not modify page. In reply to
Big Thanks to you both, I'd never have got this without your help and I feel I have learned a lot too although I still have a long way to go.

This script is awesome and I hope to make a lot more use of it in future projects so I'll very probably be back looking for more of you expeteese in the near future.

Thanks for taking the time.