We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You must opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
You are here: TWiki> Support Web>SearchFormStartUpEmpty (18 Aug 2007, SvenDowideit)
Tags:
create new tag
, view all tags

Question

I've been having a lot of fun searching for pages based on their FORMFIELD (and other META) data. I start out with a simple HTML form and search based on the data entered in the fields.

The one thing I don't like is that the page initializes with "Search for *". I want it to come up empty.

Example:

<form action="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%"> 
<input type="submit" value="Search" />
%TABLE{headerbg="#CCCCFF" columnwidths="50"}%
| *Search For<br />Author* | *Topic* | *Created<br />On* | *Created<br />By* | *Modified<br />On* | *Modified<br />By* | *Revision* |
|\
<select name="qBy" size="1">\
    <option selected="selectedYahoo"></option>\
     <option value="PeterThoeny">Peter Thoeny</option>\
   <option value="VickiBrown">Vicki Brown</option>\
  </select>|\
&nbsp;&nbsp;|\
&nbsp;&nbsp;|\
&nbsp;&nbsp;|\
&nbsp;&nbsp;|\
&nbsp; &nbsp; |
%SEARCH{"META:TOPICINFO.*?author\=.*?%URLPARAM{"qBy"}%" web="%INCLUDINGWEB%" regex="on" nosearch="on" nototal="off" regex="on" noheader="on" format="|<nop>%URLPARAM{"qBy"}% | [[$topic]] | $createdate | $createwikiusername | $date | $wikiusername | $rev |" }%
</form>

When I open the page, I want to see

Screensshot.jpg

perferably, quickly!

Instead, I see the list of all topics in the current web.

I've tried rearranging the .*? in the search but it spins (which implies it's trying a bad search).

I'm trying to work out the syntax using CALC... (no luck so far)

is there a simpler solution?

Environment

TWiki version: TWikiRelease04x00x05
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Search

-- VickiBrown - 07 Jul 2007

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

I found this method. Is there anything "simpler"?

%IFDEFINEDTHEN{"" }% 
%TABLE{headerbg="#CCCCFF"}%
| *Search For<br />Author* | *Topic* | *Created<br />On* | *Created<br />By* | *Modified<br />On* | *Modified<br />By* | *Revision* |
%SEARCH{"META:TOPICINFO.*?author\=.*?" web="%INCLUDINGWEB%" regex="on" nosearch="on" nototal="off" noheader="on" 
 format="|<nop> | [[$topic]] | $createdate | $createwikiusername | $date | $wikiusername | $rev |" }% 
%ELSEDEFINED%
  select a name to search by
%FIDEFINED%

-- VickiBrown - 07 Jul 2007

(I put the search example in a verbatim block since it puts load on the twiki.org server.)

-- PeterThoeny - 07 Jul 2007

You can also specify a default value for URLPARAM, such as %URLPARAM{ "qBy" default="[S]0mething_unlikey-to-find" }%

-- PeterThoeny - 07 Jul 2007

-- SvenDowideit - 18 Aug 2007

 
Change status to:

Topic attachments
I Attachment Action Size Date Who Comment
jpgjpg Screensshot.jpg manage 22.8 K 07 Jul 2007 - 21:02 VickiBrown Screenshot
Topic revision: r3 - 18 Aug 2007 - 18:16:38 - SvenDowideit
 
TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback