Gossamer Forum
Quote Reply
Search
Hello,

I seek a solution to post a text if no word is registered in the fields seeks?
"You must seize one or more key word before clicking on 'Search'!"


Thank you for your assistance.

Mick
Quote Reply
Re: [mick31] Search In reply to
Hello Mick, under Build > User Language > Search you can specify the text that viewers will see if a search doesn't contain results. I hope that is what you were asking, if not please do post again. :)
Quote Reply
Re: [Karen] Search In reply to
Hello Karen,

Thank you for the answer.

But, I do not explain well.

Currently, if the user does not register a word in the fields of research and it presses on the button, the page of advanced research is returned.

And, no message is indicated.

I want to indicate a message.
"You must indicate a word"

I use the Global following.

-----------------------
sub {
my $tags = shift;
my $query = $IN->param('query');
my %stopwords = map { $_ => 1 } qw/search/;
if (length $query < 3) {
return "Your research is too short ! It must be higher than 3 characters.";
}
if (exists $stopwords{$query}) {
return "The word ' $query' is not authorized.";
}
return $tags->{error}; # Display default error
}

-----------------------

I can indicate:
if (length $query < 0
return "You must indicate a word.";


But, the Global one cannot also check < 3 any more

An idea ?

Thank you for your assistance.
Quote Reply
Re: [mick31] Search In reply to
Maybe you need

if ((! $query) or (length $query < 3))
Quote Reply
Re: [afinlr] Search In reply to
Hello Afinlr

There is not chagement

< 3
The message is posted.

But with

< 0
No posted message.

How to use your line so that with

< 3 Messsage 1

and with

< 0 Message 2

Thank you for your assistance.

Mick
Quote Reply
Re: [mick31] Search In reply to
what about this

sub {
my $tags = shift;
my $query = $IN->param('query') || return "Please enter a query term";
my %stopwords = map { $_ => 1 } qw/search/;
if (length $query < 3) {
return "Your research is too short ! It must be higher than 3 characters.";
}
if (exists $stopwords{$query}) {
return "The word ' $query' is not authorized.";
}
return $tags->{error}; # Display default error
}
Quote Reply
Re: [afinlr] Search In reply to
Helo afinlr

I seek but I do not find.

I am really not good. Unsure

Mick
Quote Reply
Re: [mick31] Search In reply to
Please can you check that you are not calling the global from within <%if error%> tags. If you don't enter a search term it doesn't give an error so the global wont be run.
Quote Reply
Re: [afinlr] Search In reply to
Thank you

You were right. Smile

I would never have sought there !

Mick