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 2003-06-03 - 12:28 SamHasler  
PNGpng Search2.png manage 3.6 K 2003-06-03 - 12:28 SamHasler  
Topic revision: r7 - 2004-01-02 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.