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
-
- %TOC%
-
- 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 " and % to % 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}%,%,&#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}%,&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