Gossamer Forum
Home : Products : DBMan : Customization :

Search Options Text Turned Off ... But ...

Quote Reply
Search Options Text Turned Off ... But ...
YOUR OPINION, PLEASE >>

How can I remove the "Search Options" text from the screen and leave the functionality of it in place. I have
allow for search on a name like field, and those searches have to be EXACT WHOLE WORD searches. The
CASE or capitalization of the entry still shouldn't matter. The users can't be given any search OPTION check
boxes or any other parameters to adjust. That means that the Max. Returned Hits and the Sort by: and the
Sort Order: parameters must go away from user adjustment or sight but must be allowed to be adjusted
within the code.

In other words if someone wants to retrieve a record on "SMITH, John T"
they have to enter "SMITH, John T".

I can no longer allow partial string queries i.e. for the above name a query for
"SMITH, J" would be invalid for anyone except for someone with a last name of "SMITH" and a first name of "J"
only.

Just in case though, how can I remove the text from the screen and allow partial string search as well. For
example if some searches from "SMITH, J" the results will be "SMITH, John" and "SMITH, Joseph" etc.

I have already done this, but I would like you insight on a better way, to do it.Smile


Quote Reply
Re: Search Options Text Turned Off ... But ... In reply to
In sub html_view_search, add hidden fields to set the search options you want. To remove the search options text, delete the line

&html_search_options;

from sub html_view_search.

I'd like to see what your solution is to your problem. It might be the best one there is.


JPD
Quote Reply
Re: Search Options Text Turned Off ... But ... In reply to
I don't think this is the best solution but it is what I did. This solution may be what's causing me other problems.

Nonetheless, here it is ...

Code:


sub html_search_options {
# --------------------------------------------------------------------------------
# Search options to be displayed at the bottom of search forms.
# --------------------------------------------------------------------------------
#
# - print qq~
# - <P>
# - This listing is for information purposes only. Soliciting of Federal employees
# - is a violation of law. See Title 41 of the Code of Federal Regulations,
# - Sections 101-20.308 and 101-20.002-2.
# -

# - <HR>
# - <P>
# - <STRONG>Search Options:</STRONG>

# - <INPUT TYPE="CHECKBOX" NAME="ma"> Match Any
# - <INPUT TYPE="CHECKBOX" NAME="cs"> Match Case
# - <INPUT TYPE="CHECKBOX" NAME="ww"> Whole Words
# - <INPUT TYPE="CHECKBOX" NAME="re"> Reg. Expression<BR>
# - <INPUT TYPE="TEXT" NAME="keyword" SIZE=15 MAXLENGTH=255> Keyword Search <FONT SIZE=-1> (will match against all fields)</FONT><BR>
# - <INPUT TYPE="TEXT" NAME="mh" VALUE="$db_max_hits" SIZE=3 MAXLENGTH=3> Max. Returned Hits
# - | Sort By:
# - <SELECT NAME="sb">
# - ~; for (my $i =0; $i <= $#db_cols; $i++) { print qq~<OPTION VALUE="$i">$db_cols[$i]</OPTION>\n~ if ($db_form_len{$db_cols[$i]} >= 0); } print qq~
# - </SELECT>
# - | Sort Order:
# - <SELECT NAME="so">
# - <OPTION VALUE="ascend">Ascending
# - <OPTION VALUE="descend">Descending
# - </SELECT>


# - ~;
# --------------------------------------------------------------------------------

# --------------------------------------------------------------------------------
# reb. Re-written mod.
#
# Per project owner request all options are removed from user control.
#
# For INPUT TYPE where NAME="ww" VALUE="on"
# this says turn on Whole Word (ww) only search, on the input field.
# For INPUT TYPE where NAME="sb" VALUE="1"
# this says, SORT BY (sb) the field number "1" which is "lname"
# Look in deault.cfg to get field numbers and names.
# For INPUT TYPE where NAME="so" VALUE="ascend"
# this says, SORT ORDER (so) is "ASCEND" on the field designated by a
# "sb" INPUT TYPE.
# --------------------------------------------------------------------------------
# my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
# my $font = 'Font face="Verdana, Arial, Helvetica" Size=2';

print qq~
<HR>
<Font face="Verdana, Arial, Helvetica" Size=-2><strong><center>
This listing is for information purposes only. Soliciting of Federal employees
is a violation of law. See Title 41 of the Code of Federal Regulations,
Sections 101-20.308 and 101-20.002-1.
</font></strong></center>
<HR>
<P>
<INPUT TYPE="hidden" NAME="ww" value="on">
<INPUT TYPE="hidden" NAME="sb" VALUE="1">
<INPUT TYPE="hidden" NAME="so" VALUE="ascend">
</p>
~;

# --------------------------------------------------------------------------------
# reb. Removing search tips messages. The tips did not make sense for explaining
# the "*" option. This option must be deactivated anyway.
# <strong>Search Tips:</strong>

# - use '*' to match everything in a field)<BR>
# - put a '>' or '<' at the beginning to to do
# range searches.<BR>
}

Thanks. Smile


Quote Reply
Re: Search Options Text Turned Off ... But ... In reply to
Looks good to me. I don't see how it could cause any problems.

JPD
Quote Reply
Re: Search Options Text Turned Off ... But ... In reply to
JPD,

I don't believe I can apply your solution by deleting the &html_search_options; from the
sub html_view_search routine. I still need the options to take effect, I just can't show
them to the users or allow them to change them. However, I still need the sort order to be
ascending, on the last_name and first_name field, and I need the whole words restriction
activated for both the last_name, and first_name field. Some of this isn't working, the sort
order does not sort on both last_name and first_name.

What should be ...
Code:
SMITH, A
SMITH, B
SMITH, C
SMITH, D
.
.
.
Actually comes back in the results set as ...
Code:
SMITH, B
SMITH, D
SMITH, A
SMITH, C
.
.
.
Can you help me out here?

Thank you. Smile

Quote Reply
Re: Search Options Text Turned Off ... But ... In reply to
You can delete &html_search_options; from sub html_view_search *if* you add the hidden fields to sub html_view_search instead of having them in sub html_search_options. I didn't realize you had put them there.

I'm a little confused (make that *a lot* confused! Smile). I thought that your database had one field for the name, in the form of
LastName, FirstName MiddleName

Isn't that what you said in another thread?

JPD
Quote Reply
Re: Search Options Text Turned Off ... But ... In reply to
Hey JPD,

That's not really the answer I expected, since the problem does exist. Nonetheless, if that's the way it must be, then that's the way it must be. Frown

Obviously, the last_name value should be sorted because for the most part the search can only be done on a single last name value. Therefore the single last_name value is returned and sorting makes no sense. But what about sorted first_name that accompany the last_name field value?

What am I not doing?

Thanks. Smile

Quote Reply
Re: Search Options Text Turned Off ... But ... In reply to
JPD Thanks for the response.

You are not confused, well maybe you are. I have 4 threads going right now and you have responded to all of them.

My record layout looks like the following ...
Code:

rowseq | last_name | first_name | middle_name | display_name | phone_number
1 Quinten Charles Robert Quinten, R C (222)999-9999

The actual search occurs on the "last_name" field and optionally on the "first_name"
field. However, I return the "display_name" in the result set to the user.

Thanks. Smile


Quote Reply
Re: Search Options Text Turned Off ... But ... In reply to
Is the "display name" a field? If so, you could sort on that field.

Or, since you require a last name to be entered in a search, you could sort by the first name field.

Or you could try the "sort on multiple fields" mod which is at http://www.gossamer-threads.com/...m12/HTML/001080.html.

When I said that your code would not cause a problem, I just meant that it would do the same thing as the search options. By default, DBMan sorts on one field only. You have to do some tweaking to get it to sort on more than one.


JPD
Quote Reply
Re: Search Options Text Turned Off ... But ... In reply to
Hi JPD,

Thanks for a response.

Yes. The "display_name" is a field. I originally did the search and sort on that field. I split the "last_name" field off to try and get around a problem I was having with "whole word", originally.

Then the project owner made a mandatory criteria change, that essentially stated that the "last_name" field be the only one that is required to be entered and searched on. Optionally, a user can add a "first_name" value to the search criteria but the search could not go forward unless a "last_name" value was also entered.

I'll see how I can tie the search mod into the code.

Thank you. Smile

Quote Reply
Re: Search Options Text Turned Off ... But ... In reply to
I want to make sure that you understand that it is not necessary to search and sort on the same field. You can search on the "last name" field and sort by the "display name" field. Perfectly legal. Smile


JPD
Quote Reply
Re: Search Options Text Turned Off ... But ... In reply to
Hi JPD,

Thanks for the response.

Yeah I knew (a little) that you could split field purposes. Like what I do different from the default install, is search on "last_name", but I display "display_name". But I didn't know you could sort on a different field than you search on, in this language. I should have known though, everything is done in arrays, why not be able to do this.

Just need to know the code of the how to, and try a lot of different things, for a long time.

And, most importantly, have someone like JP Deni willing to work with you, help you out, and teach you. Wink

Thanks. Smile

Quote Reply
Re: Search Options Text Turned Off ... But ... In reply to
Hi JPD.

Thanks for ALL of the responses.Smile

Okay I understand what you're saying (now remember, I'm no expert at this stuff yet, so be kind)
when you say ...
In Reply To:
I want to make sure that you understand that it is not necessary to search and sort on the same
field. You can search on the "last name" field and sort by the "display name" field. Perfectly legal.
... but, how do you formulate this, and where do you put it?

That "multi sort field" hyper-link might be helpful in the future but I am back to a one field sort, that's different from the search field.

Thanks. Smile


Quote Reply
Re: Search Options Text Turned Off ... But ... In reply to
Hi JPD.

I would like to cancel the last question.

I figured it out most of it.Smile

Code:
I left this line alone:

<INPUT TYPE="hidden" NAME="ww" value="on">

I Changed this line:

<INPUT TYPE="hidden" NAME="sb" VALUE="1">

To:

<INPUT TYPE="hidden" NAME="sb" VALUE="4">

I left this line alone:

<INPUT TYPE="hidden" NAME="so" VALUE="ascend">
I could be wrong but I believe this VALUE="4" determines what field number in the record
these actions are taken against.

How does this affect the "whole word" criteria for the search field which is field number "1".

Thanks. Smile


Quote Reply
Re: Search Options Text Turned Off ... But ... In reply to
In Reply To:
I believe this VALUE="4" determines what field number in the record these actions are taken against.
Not exactly. It is the field that the results are sorted by. Only sorted. Has nothing whatever to do with the search.

In Reply To:
How does this affect the "whole word" criteria for the search field which is field number "1".
Not one iota. Smile


JPD