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 History Action Size Date Who Comment
PNGpng Search1.png r1 manage 5.8 K 2003-06-03 - 12:28 UnknownUser  
PNGpng Search2.png r1 manage 3.6 K 2003-06-03 - 12:28 UnknownUser  
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2004-01-02 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.