Gossamer Forum
Home : Products : DBMan : Customization :

Search on only certain fields

Quote Reply
Search on only certain fields
Hi JP.

I am having problems with having too many search option fields in my search to the visitors.

Is there some way for when guests do a search they only see certain fields but when listing the records he searched for he gests all the fields but when the admin is going to search or enter a new record he can see every field?

I think it can be done with invisible fields but I don't understand very well the procedure, but I need the guest to search for only a few but get back the complete information for the records he searched for.

UGGHH. Did you get this?? :-)

Thanks

BrianL
Quote Reply
Re: Search on only certain fields In reply to
Okay...so you want to have certain fields show up just for the admin, right?

Here is what you do...In your sub html_record routine, add the following codes:

Code:
if ($per_admin) {
print qq|$rec{'FieldName'}|;
}

If you want people to view their complete record and they have modify permissions, you can use the following codes:

Code:
if ($per_mod) {
print qq|$rec{'FieldName'}|;
}

Change FieldName with the name of the field that you only want the admin to see. You can add HTML codes (like table and font) between the print qq| and |;.

BTW: This has been discussed MANY times in this forum...Try using the search engine to find Threads that pertain to your questions or problems. It does work.

Wink

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

[This message has been edited by Eliot (edited October 08, 1999).]
Quote Reply
Re: Search on only certain fields In reply to
The easiest way to have a separate search form from the input form is to create a separate subroutine for the search form.

Copy sub html_record_form and paste it below the current one. You'll now have two identical subroutines. Rename the second one to sub html_search_form. Delete all the fields you don't want people to search on.

Go down to sub html_view_search and change

&html_record_form();

to
Code:
if ($per_admin) {
&html_record_form();
}
else {
&html_search_form();
}

Make a similar change in sub html_view_failure.

Eliot has a point about searching, but the search engine on the forum is so bad that I can rarely find anything I'm looking for.



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





Quote Reply
Re: Search on only certain fields In reply to
Thanks a lot guys.

Eliot is right, I should look in the search forum first but as you say, JP, I rarely get the answer I am looking for beacuse everybody's problem is different.

I think I like JP's idea the most, because I want the visitors to list with all the fields but search for only a few. Because I forgot to say that the only person that in this case changes, or enters new information is the Admin. Gests only search and list. They do not modify or delete.

Thanks a lot both of you! It's great to have help when needed.! I'll Try it. :-)

Best regards.

BrianL
Quote Reply
Re: Search on only certain fields In reply to
Ok,

So with JP's answer, I should change...

|; &html_record_form(); print qq|
|; &html_search_options; print qq|

TO....

|; if ($per_admin) {&html_record_form();}
else {&html_search_form();} print qq|

Is this correct?


------------------
http://www.christjam.com
Quote Reply
Re: Search on only certain fields In reply to
Yes.

Regards,


------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------