A small enhancement for
%URLPARAM{}%
:
It supports now a
newline="..."
argument, e.g.
%URLPARAM{ "description" newline="<br />" }%
This is useful if you have a textarea field content passed to a topic, and you want to process the content on a single physical line, for example to pass it on to another variable (like applying it to a
SpreadSheetPlugin formula), or to put it into a TWiki table.
Enhancement is in
TWikiAlphaRelease (for
CairoRelease) and TWiki.org. Docs in
TWikiVariables are updated.
Feedback and ideas for enhancements is appreciated. See also related
UrlParamWithDefaultValue.
--
PeterThoeny - 23 Aug 2003
So, my impression is that newlines in the topic are replaced with whatever is specified after "newline="?
I guess that must be the case — I think a more explicit statement would be helpful to people like me, so I don't have to think too much.
--
RandyKramer - 23 Aug 2003
Another useful application for this is to process formdata in a Plugin instead of a standalone script that clutters the bin directory. For example, Plugins like
CommentPlugin and
ActionTrackerPlugin could be done without standalone scripts:
- The form gets submitted to a Plugin maintenance topic, e.g. a
CommentPluginAdmin
topic; possibly calling viewauth
instead of view
for authenticated action
- The form has, among other fields, a hidden
pluginaction
field of value save
- The admin topic passes the parameters along to the Plugin, e.g.:
-
%COMMENT{ pluginaction="%URLPARAM{pluginaction}%" otherparam="%URLPARAM{otherparam}%" }%
- A newline-escaped parameter can be added if needed:
-
textareaparam="%URLPARAM{"textareaparam" newline="%_NL_%" }%"
- The
pluginaction
parameter makes sure that a normal topic view does not fire off the save action.
- If and only if the
pluginaction
is save
, the save action is performed. The Plugin could return a thank you message.
Here is a silly example for testing: Enter a few short lines
--
PeterThoeny - 23 Aug 2003
In my environment I get a URL parameter
?testarea=xxx%0D%0Ayyy
when entering two lines (
xxx
and
yyy
). I am intersted to know if other environments produce different line endings. This enhancement should handle different line endings correctly.
--
PeterThoeny - 23 Aug 2003