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>|\
|\
|\
|\
|\
|
%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
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
--
VickiBrown - 07 Jul 2007
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is 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