Delayed Search

Search:

-- Contributors: Main.PeterThoeny - 05 Aug 2006 (TWiki:Sandbox.DelayedSearch)

Discussion

Above search form submits the query to the same page. The topic has a %SEARCH{}% that is disabled when you arrive at this page. That is, the page loads fast.

How this works:
  • The HTML form has a hidden input field:
    <input type="hidden" name="p" value="%" />
  • Below the form is a %SEARCH{}%, with the percent signs of the SEARCH replaced by URL parameters:
    %URLPARAM{ "p" default="<!--" }%SEARCH{ "%URLPARAM{ "q" }%" nonoise="on" }%URLPARAM{ "p" default="-->" }%
  • When you arrive at this page, e.g. when there are no URL parameters, above SEARCH gets rendered as <!--SEARCH{....}--> (that is, the SEARCH is disabled and hidden in HTML comments)
  • When you run a query, the p URL param supplies a percent sign, which enables the SEARCH

-- Main.PeterThoeny - 05 Aug 2006

In case anyone else arrives at this page and is confused by the apparent %SEARCH in the wrapped code, that % doesn't belong with the SEARCH -- no matter how much it looks like it does :-) That's the closing % of the preceding %URLPARAM{.

Duh. :-)

-- Main.VickiBrown - 19 Dec 2007
 
Topic revision: r1 - 20 Dec 2007, VickiBrown
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email