Gossamer Forum
Home : Products : DBMan : Installation :

$message when search for less than 2 letters

Quote Reply
$message when search for less than 2 letters
Is there a way to let dbman send an error message when someone tries to search for words with less than 2 letters or <space>.
Thx again.
Quote Reply
Re: $message when search for less than 2 letters In reply to
I don't think you'll have to worry about people searching for a space. I believe the script takes out leading and trailing spaces. But I could be wrong.

If you just wanted it to ignore any searches with only one letter, you could add this to sub query, before

if ($in{'keyword'}) { # If this is a keyword search, we are searching the same

Code:
foreach $column (@db_cols) {
if (($in{$column}) and (length($in{$column}) < 2)) {
$in{$column} = "";
}
}

If you want to send back an error message, you can use

Code:
foreach $column (@db_cols) {
if (($in{$column}) and (length($in{$column}) < 2)) {
return "Must have at least two letters in each search term";
}
}

I haven't tested this, but it seems like it would work.


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