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 need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
Tags:
create new tag
, view all tags

Question

I've added a search form to the search results template for our intranet site (behind firewall) and I've added %URLPARAM{search}% as the value for the text input thus:

<input type="text" name="search" size="18" value="%URLPARAM{search}%" />

However, if you search for %X% to find out where the TWikiDocGraphics are used it will evaluate the variable and the image tag it puts in messes up the input box. Is there a way to avoid this? I can't see how to do it with <pre>, <verbatim>, <nop> or the variable SEARCHSTRING.

Below is an example searching for TOC and %TOC%

TOC
Search1.png

%TOC%
Search2.png

  • TWiki version: 01 Feb 2003
  • Perl version: 5.6.1
  • Web server & version: Apache/1.3.26
  • Server OS: (Unix) Debian GNU/Linux
  • Web browser & version: IE6
  • Client OS: Windows 2000

-- SamHasler - 03 Jun 2003

This is also a problem when the search term is a regex containing quotes.

What I think is required is for URLPARAM to convert " to &quot; and % to &#037; but I don't know if this will have an adverse affect on other uses of URLPARAM. Is another variable/function required?

Maybe I should have made this a feature request in codev.

-- SamHasler - 05 Aug 2003

Answer

Try a $SUBSTITUTE() SpreadSheetPlugin formula to substitute the special chars in the %URLPARAM before handing it off to the HTML text input. Let us know if this works.

-- PeterThoeny - 10 Aug 2003

The following works for percents, but any quote in the parameter seems to terminate the calc string.

%CALC{"$SUBSTITUTE(%URLPARAM{search}%,%,&amp;#037;)"}%

-- SamHasler - 11 Aug 2003

Oh, does \" work? If not it is time to introduce escape vars for $SUBSTITUTE, e.g. $sp for space, $quot for double quote, etc.

-- PeterThoeny - 12 Aug 2003

I tried:

   * %CALC{"$SUBSTITUTE(%URLPARAM{search}%,\034,quote,,r)"}%
   * %CALC{"$SUBSTITUTE(%URLPARAM{search}%,[\"],quote,,r)"}%
   * %CALC{"$SUBSTITUTE(%URLPARAM{search}%,\",quote)"}%
   * %CALC{"$SUBSTITUTE(%URLPARAM{search}%,&amp;quot;,quote)"}%
   * %CALC{"$SUBSTITUTE(%URLPARAM{search}%,'\"',quote)"}%
   * %CALC{"$SUBSTITUTE(%URLPARAM{search}%,["],quote,,r)"}%
   * %CALC{"$SUBSTITUTE(%URLPARAM{search}%,'"',quote)"}%
   * %CALC{"$SUBSTITUTE(%URLPARAM{search}%,",quote)"}%
   * %CALC{"$SUBSTITUTE(%URLPARAM{search}%,""",quote)"}%
   * %CALC{"$SUBSTITUTE(%URLPARAM{search}%,"\"",quote)"}%
to no avail.

-- SamHasler - 12 Aug 2003

Topic attachments
I Attachment Action Size Date Who Comment
pngpng Search1.png manage 5.8 K 03 Jun 2003 - 12:28 SamHasler  
pngpng Search2.png manage 3.6 K 03 Jun 2003 - 12:28 SamHasler  
Topic revision: r7 - 02 Jan 2004 - 07:10:24 - PeterThoeny
 
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